SN8P2501D
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 80
Version 1.5
8.3.9 TC0 TIMER OPERATION EXPLAME
TC0 TIMER CONFIGURATION:
; Reset TC0 timer.
MOV
A, #0x00
; Clear TC0M register.
B0MOV
TC0M, A
; Set TC0 rate and auto-reload function.
MOV
A, #0
nnn
0000b
; TC0rate[2:0] bits.
B0MOV
TC0M, A
B0BSET
FALOAD0
; Set TC0C and TC0R register for TC0 Interval time.
MOV
A, #
value
; TC0C must be equal to TC0R.
B0MOV
TC0C, A
B0MOV
TC0R, A
; Clear TC0IRQ
B0BCLR
FTC0IRQ
; Enable TC0 timer and interrupt function.
B0BSET
FTC0IEN
; Enable TC0 interrupt function.
B0BSET
FTC0ENB
; Enable TC0 timer.
TC0 EVENT COUNTER CONFIGURATION:
; Reset TC0 timer.
MOV
A, #0x00
; Clear TC0M register.
B0MOV
TC0M, A
; Set TC0 auto-reload function.
B0BSET
FALOAD0
; Enable TC0 event counter.
B0BSET
FTC0CKS
; Set TC0 clock source from external input pin (P0.0).
; Set TC0C and TC0R register for TC0 Interval time.
MOV
A, #
value
; TC0C must be equal to TC0R.
B0MOV
TC0C, A
B0MOV
TC0R, A
; Clear TC0IRQ
B0BCLR
FTC0IRQ
; Enable TC0 timer and interrupt function.
B0BSET
FTC0IEN
; Enable TC0 interrupt function.
B0BSET
FTC0ENB
; Enable TC0 timer.