using STDM 102 ARM®-based 32-bit MCUs, write an assembly routine to turn on one of the user LED’s. You have to configure the I/O lines first. This should be done in a subroutine. Now that you can control the LED, write a routine to blink the LED. HINT: toggling an LED in code happens very quickly!! Use a delay routine to leave an LED on long enough to see it light up. At the end of this phase, have your code blinking the LED off and on in a loop 10 times. Then Then write a routine such that when the user presses the switch down, the LED will come on. When the user depresses the switch the light will turn off. This is called polling the state of the switch.
using STDM 102 ARM®-based 32-bit MCUs, write an assembly routine to turn on one of the user LED’s.
You have to configure the I/O lines first. This should be done in a subroutine.
Now that you can control the LED, write a routine to blink the LED. HINT: toggling an LED in code happens very quickly!! Use a delay routine to leave an LED on long enough to see it light up. At the end of this phase, have your code blinking the LED off and on in a loop 10 times. Then
Then write a routine such that when the user presses the switch down, the LED will come on. When the user depresses the switch the light will turn off. This is called polling the state of the switch.
For the purposes of this solution, I will assume that you are using the STM32F102 series MCU. The exact names and values of registers might differ based on the exact STM32F102 model and the board being used.
I'll provide a general solution, and you might need to adjust it for your specific MCU/board.
Before we can control the LED, we need to configure the I/O pin connected to the LED as an output. This is done by setting the appropriate bits in the GPIOx_CRH or GPIOx_CRL register.
Step by step
Solved in 5 steps