Write an ARM assembly program to implement a Time-Of-Day clock application
$10-30 USD
Closed
Posted almost 6 years ago
$10-30 USD
Paid on delivery
Write an ARM assembly program to implement a Time-Of-Day clock application as specified below:
The TOD Clock will have 4 separate counters:
HR Indicator: indicates the hour of the day with values ranging from 0 - 24
MIN Indicator: indicates the current minute with values ranging from 0 - 60
SEC Indicator: indicate the current second with values ranging from 0 - 60
MSEC: indicates the current msec with value ranging from 0 - 1000
The TOD Clock must be accurate to 1 msec resolution
The time of date is updated anytime any of the indicators is wrapped around to 0.
To enable the SysTick interrupt as well as to create a SysTick interrupt handler, follow the attached example.
[login to view URL] the document
NOTE: In your code comments, show your calculation of the reload value using clock frequency.
Hints:
- You can set up the SysTick interrupt to time out every 1 msec
- The reload value must be calculated based on the clock setting
- Anytime a time indicator wraps around from max value to 0, the next indicator above it will be incremented by 1
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; interrupt.s
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EXPORT __initial_sp
Stack_Size EQU 0x00000200
SysTick_CTRL EQU (0xE000E010)
SysTick_LOAD EQU (0xE000E014)
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp
AREA counter, DATA
ALIGN
intCount DCD 0
AREA vectors, CODE, READONLY
EXPORT __Vectors
__Vectors DCD __initial_sp
DCD Reset_Handler
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD 0
DCD SysTick_H
AREA program, CODE, READONLY
EXPORT Reset_Handler
Reset_Handler LDR R0, =__main
BLX R0
SysTick_H LDR R0, =intCount
LDR R1, [R0]
ADD R1, #1
STR R1, [R0]
BX LR
AREA myData, DATA
ALIGN
a DCD 1
AREA myCode, CODE
EXPORT __main
ALIGN
ENTRY
__main PROC
LDR R0, =SysTick_LOAD
MOV R1, #0x2EE0
STR R1, [R0]
LDR R0, =SysTick_CTRL
MOV R1, #3
STR R1, [R0]
LDR R0, =a
MOV R5, #0
repeat
STR R5, [R0]
B repeat
ENDP
END