Question: Using ARM cortex m 4 assembly: Part one ( 0 . 3 points ) : Write a program to increment the value in register 0
Using ARM cortex m assembly:
Part one points: Write a program to increment the value in register by one each time
the button PA is pressed input goes from to Dont debounce. When testing this
code, press the button twenty times and see how many presses are counted. Dont be
surprised if the count is sometimes greater than twenty due to single presses being double
counted due to the lack of debouncing. Dont forget to initialize the button.
Part two points: Fill out the code below to do as each comment requires youll need
more than one line of code per comment This code will go in your main section. For the
delay loops, you may need to experiment with the starting value from which you subtract
see April lecture
;initialize PDoutput by calling initialization subroutine
;turn off all lights to start this can be in the initialization
;turn on only PD
;delaywait ~half a second using a delay loop
;turn on only PDturn PD off
;delaywait ~half a second
;turn on only PDturn PD off
;delaywait ~half a second
;turn on only PDturn PD off
;delaywait ~half a second
;turn all lights off
;delaywait ~half a second
;start the cycle again with PD on then wait, etc.
Part three points: write a program that loops through a nullterminated readonly byte
array called Numbers and displays each value on the lights. Each value in Numbers can be
between one and fifteen inclusive with a x at the end of the array, of course, as its
nullterminated. This will be shown on the LEDs with bit being represented with PD bit
with PD bit with PD and bit with PD Youll move to representing the next value
in the array after the button PA is pressed and released goes from unpressed to
pressed and then back to unpressed After displaying the nulltermination character,
start the array again from the beginning.
Example:
If the Numbers array is then the PD will be off, off, off, on respectively,
to represent as binary
After the button is pressed and released, PD will be on on off, off to represent as
binary
After the button is pressed and released again, PD will be on off, off, on to represent
as binary
After the button is pressed and released again, PD will be on on on off to represent
as binary
After the button is pressed and released again, PD will all be off to represent
After the button is pressed and released again, PD will go back to as that is the
first value in the array, and the cycle will repeat.
Hints:
Use the initialization subroutines for GPIO that weve already written
Youll need to debounce the button presses by putting a delay between IDR reads
see the April lecture for more
Since bits of the value correspond to GPIOD ODR bits you can use shifting
to help turn the appropriate LEDs on Just make sure to turn off lights you wont
need.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
