Question: Please write using ARM Assembly for STM 3 2 F 4 1 1 VETx and an STM 3 2 Microcontroller . The modes interact with

Please write using ARM Assembly for STM 32 F 411 VETx and an STM 32 Microcontroller .The modes interact with the LEDs on the board, and should be subroutines. It should all be one block of code.
****** Please note the attached screenshot is an example of what our code has looked like in the past! While the function of the attached code will not help while answering this question, im hoping it should help you understand the snytax and formatting for this code. ******
The final project will entail writing a program with three modes: Mode A The lights will start all off, then turn on (and stay on) one at a time: orange, then red, then blue, and lastly green. They will then turn off (and stay off) one at a time in that same order. Once all are off, the cycle will repeat. Put a 0.25 second pause between each change. (For example, if all lights are off, the orange LED will come on and stay on, then 0.25 seconds later the red LED will also come on.0.25 seconds after that, the blue LED will come on, etc.) Mode B The blue light will toggle/blink once per second, the red light will toggle every 0.75 seconds, the orange light will toggle every half second, and the green light will toggle every 0.25 seconds. Mode C The program will read in byte values from a null-terminated, read-only array called ModeCVals and display them on the lights. If the value is between 1 and 15, the bits will correspond such that PD 15 represents bit 3, PD14 for bit 2, PD13 for bit 1, and PD12 for bit 0. For example, if the value to be displayed is 6, thats 2_00000110 so PD15 would be off, PD14 and PD13 would be on, and PD12 would be off. If the value in the array is larger than decimal fifteen (0x0F), do not turn on any of the lights for its representation. Each values LED representation should display for one second before changing directly to the next value. The null-termination character counts as a value (its zero). After displaying the final (0x00) value, loop around to the beginning of the ModCVals array and start displaying the values from the beginning again. The user will switch between these modes by pressing the PA0 input button. The change in mode can occur at any point during the mode (as opposed to finishing the cycle of blinks before starting the next. When the button is pressed while the program is on Mode C, it should loop around and begin Mode A again. Hints: Use an interrupt for the input. Debounce your input. If a timer triggers every 0.25 seconds, then something that occurs every third timer trigger will occur once every 0.75 seconds. Moving bits 3 through 0 to bits 15 through 12 is a matter of shifting. Make DATA area values to be used as counters or to track what mode youre in.
Please note I already have had this question answered on chegg, but the answer was incomplete, and did not match the formatting I provided. Here is the code I was given:
AREA RESET, DATA, READONLY
EXPORT Reset_Handler
Reset_Handler
LDR SP,=_estack ; Set stack pointer
AREA HWOOB, CODE, READONLY
IMPORT SystemInit
IMPORT main
BL SystemInit
BL main
B .
_main PROC
BL LED_Init ; Initialize LEDs and GPIO
BL Button_Init ; Initialize button for mode switching
MOV R6, #0 ; R6 will keep track of the current mode
ModeSelect:
LDR R0,[R7] ; Load button press status into R0
CMP R0, #1 ; Check if button was pressed
BEQ ChangeMode ; If yes, change mode
CMP R6, #0 ; Check which mode is active
BEQ ModeA
CMP R6, #1
BEQ ModeB
CMP R6, #2
BEQ ModeC
ChangeMode:
ADD R6, R6, #1 ; Increment mode
CMP R6, #3
MOVLE R6, #0 ; If mode index is 3, reset to 0(Mode A)
B ModeSelect
ModeA:
BL Perform_ModeA ; Execute Mode A operation
B ModeSelect
ModeB:
BL Perform_ModeB ; Execute Mode B operation
B ModeSelect
ModeC:
BL Perform_ModeC ; Execute Mode C operation
B ModeSelect
ENDP
LED_Init PROC
PUSH {LR}
LDR R0,=RCC_AHB1ENR ; RCC AHB1 peripheral clock enable register
LDR R1,[R0]
ORR R1, R1, #0x08 ; Enable GPIOD clock
STR R1,[R0]
LDR R0,=GPIOD_MODER ; GPIOD mode register
LDR R1,[R0]
MOV R2, #0x55550000 ; Set mode to output for PD12-PD15
ORR R1, R1, R2
STR R1,[R0]
POP {PC}
ENDP
Button_Init PROC
PUSH {LR}
; Configuration code for button initialization with debouncing
POP {PC}
ENDP
Perform_ModeA PROC
PUSH {LR}
; Insert logic for Mode A (LED sequence operations)
POP {PC}
ENDP
Perform_ModeB PROC
PUSH {LR}
; Insert logic for Mode B (LED blinking at different rates)
POPAREA HW09B, CODE
ENTRY
EXPORT _ main
Please write using ARM Assembly for STM 3 2 F 4 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!