BASIC TIMER and TIMER 0
S3C80A5B
10-10
F
PROGRAMMING TIP — Programming Timer 0 (Continued)
T0INT
PUSH
RP0
; Save RP0 to stack
SRP0
#60H
; RP0
←
60H
INC
R0
; R0
←
R0 + 1
ADD
R2,R0
; R2
←
R2 + R0
ADC
R3,R2
; R3
←
R3 + R2 + Carry
ADC
R4,R0
; R4
←
R4 + R0 + Carry
CP
R0,#32H
; 50
×
4 = 200 ms
JR
ULT,NO_200MS_SET
BITS
R1.2
; Bit setting (61.2H)
NO_200MS_SET:
LD
T0CON,#42H
; Clear pending bit
POP
RP0
; Restore register pointer 0 value
T0OVER
IRET
; Return from interrupt service routine