程序代写代做代考 C arm assembly Project: ELEC1710 – Project Part C

Project: ELEC1710 – Project Part C
Student Number Display with ARM Assembly, October 22, 2020 ELEC1710-
ELEC1710 – Project Part C
Student Number Display with ARM Assembly
Brenton Schulz
Due date: 2pm Tuesday of Week 11
Submission: Upload your final .s files to Blackboard as an assignment submission Marking: During your Week 11 lab
Weighting: 10% of your final grade
1 Introduction
This project task will explore three ways to display your student number on a 7-segment display connected to an STM32F103 microcontroller.
2 Hardware Configuration
The hardware build for this project is identical to that required for Lab 5. In summary:
• 4x tactile switches connected to PA8, PA9, PA10, and PA11
• Segments a-g of a 7-segment display connected to PC0-PC6, respectively
• Power (+3.3V) and GND jumper wires from the NUCLEO-F103RB development board to the bread- board
3 Tasks
This project has three tasks, all of which result in your student number being displayed on a 7-segment display. They differ based on where the data written to the 7-segment display comes from.
You should create a new .s file for each task, each with a unique label at the start of your code and a corresponding .global statement near to the top of the file so that your assembly code can be called from main.c. Use the existing sseglut.s template on Blackboard as a starting point then change:
• The file name (task1.s, task2.s, etc is fine)
• The sseglut: label to task1: (or task2:, etc)
• The .global sseglut statement to .global task1, etc
• For Tasks 1 and 2, replace the b sseglut instruction with bx lr. This will cause execution to “return” back to main.c after your code has finished executing
• For Task 3, replace b sseglut with b task3 (or whatever you chose to name it) so that the code loops forever
• When demonstrating, modify main.c so that task1(); task2(); (etc) are called in sequence. Use the debugger to control the program execution so that Tasks 1 and 2 are stepped through as single instructions.
Note that the code for Tasks 1 and 2 will be very repeditive. Once you have code which works for one digit you can copy/paste it 7 times and modify each copy slightly as appropriate.
Page 1 of 3 Brenton Schulz

Project: ELEC1710 – Project Part C
Student Number Display with ARM Assembly, October 22, 2020 ELEC1710-
3.1 Task 1
Write ARM assembly which loads digits of your student number from hard-coded 8-bit constants using the ldr Rd, =C pseudo instruction syntax then displays them on the 7-segment display.
Your program must load the required 7-segment display data with ldr Rd, =C then move it to PORTC as-per Lab 5. You may copy the relevant constants from the Lab 5 LUT when writing this code.
Your code will contain 8 “blocks”, each of which displays one of the digits. Every block will be very similar and perform the following steps:
1. Load the correct display data into a register
2. Write that data to GPIOC ODR so that it appears on the 7-segment display
When demonstrating your code step through each instruction with the debugger to show the following for
each digit of your student number:
• The correct constant being loaded into a register with an ldr Rc, =C pseudo instruction • That constant being written to GPIOC ODR (use the “SFR” debug window to show this)
• The correct digit being displayed on the 7-segment display
3.2 Task 2
Write ARM assembly which loads digits of your student number from hard-coded offsets in the Lab 5 LUT with ldrb Rd, [Rm, #offset] instructions. Remember that the table entries are 8-bits so lrdb is used instead of ldr. In this case Rm will contain the base address of the LUT and #offset will index a byte within the LUT. Write instructions which progressively read the appropriate digits from the LUT to display your student number on the 7-segment display. ie: Your code would first read offset 12 to read the “C” data, store it to GPIOC ODR, then read from LUT offset 3, etc.
You should ensure that the whole LUT is copied from sseglut.s into your own task2.s file. Don’t forget the .align 4 statement! You may instead add a .global ssegdata statement to sseglut.s so it can be “seen” from other files but this is an optional (and advanced) method.
When demonstrating your code step through each instruction with the debugger to show the following for each digit of your student number:
• The correct LUT data being loaded into a register with an ldrb Rd, [Rm, #offset] instruction • That constant being written to GPIOC ODR (use the “SFR” debug window to show this)
• The correct digit being displayed on the 7-segment display
3.3 Task 3
Modify your Lab 5 code so that counting in binary on the tactile switches displays your student number. ie: Implement the same behaviour from your Part B breadboard circuit with the STM32.
Note that your student number only requires 3 tactile switches to index every digit. Modify the Lab 5 code so that only the 3 least significant switches are read (ie: modify the ubfx instruction to only extract 3 bits).
To do this you will need to complete Lab 5 then modify the LUT so that offset 0 contains the data for “C”, offset 1 contains data for “3”, etc.
Run this code at full speed when demonstrating. Only step through each instruction when debugging/de- veloping your code.
Page 2 of 3 Brenton Schulz

Project: ELEC1710 – Project Part C
Student Number Display with ARM Assembly, October 22, 2020
4 Marking Guide
4.1 Task 1 : 3 Marks
ELEC1710-
If stepping through the code results in the student number appearing on the 7-segment display:
• And the correct form of ldr Rd, =C was used to load 7-segment data: +3 Marks
• If there are one-3 single segment or digit errors: 1 Mark
• If the wrong ldr syntax was used: Maximum 1.5 marks, at the discretion of the demonstrator
If the code mostly doesn’t work but there is evidence of a “solid attempt” as judged by the demonstrator: 1 Mark total for this task
4.2 Task 2 : 3 Marks
If stepping through the code results in the student number appearing on the 7-segment display:
• And 7-segment data is correctly loaded from the LUT as it appeared in the Lab 5 template
code: +3 Marks
• If there are one-3 single segment or digit errors: 1 Mark
• If the LUT is not used or was otherwise modified: maximum 1.5 Marks at the discretion of the demonstrator
If the code mostly doesn’t work but there is evidence of a “solid attempt” as judged by the demonstrator: 1 Mark total for this task
4.3 Task 3 : 4 Marks
With the code running at full speed and the project mostly or completely working:
• “Typing” 000 to 111 on the switches outputs your student number on the 7-seg display: +4 Marks • For each segment or digit error: -1 Mark
– NB: The “tail” segments on 6 and 9 are optional and do not constitute an error.
If the code mostly doesn’t work but there is evidence of a “solid attempt” as judged by the demonstrator: 1 Mark total for this task
Page 3 of 3 Brenton Schulz