SN8P1600
8-bit micro-controller
TC1 TIMER COUNTER OPERATION SEQUENCE
The TC1 timer’s sequence of operation can be following.
ꢂ
ꢂ
ꢂ
ꢂ
ꢂ
ꢂ
ꢂ
Set the TC1C initial value to setup the interval time.
Set the TC1ENB to be “1” to enable TC1 timer counter.
TC1C is incremented by one with each clock pulse which frequency is corresponding to TC1M selection.
TC1C overflow if TC1C from FFH to 00H.
When TC1C overflow occur, the TC1IRQ flag is set to be “1” by hardware.
Execute the interrupt service routine.
Users reset the TC1C value and resume the TC1 timer operation.
ꢃ
Example: Setup the TC1M and TC1C without auto-reload function.
B0BCLR
B0BCLR
MOV
FTC1IEN
FTC1ENB
A,#20H
; To disable TC1 interrupt service
; To disable TC1 timer
;
B0MOV
MOV
B0MOV
TC1M,A
A,#74H
TC1C,A
; To set TC1 clock = fcpu / 64
; To set TC1C initial value = 74H
;(To set TC1 interval = 10 ms)
B0BSET
B0BCLR
B0BSET
FTC1IEN
FTC1IRQ
FTC1ENB
; To enable TC1 interrupt service
; To clear TC1 interrupt request
; To enable TC1 timer
ꢃ
Example: Setup the TC1M and TC1C with auto-reload function.
B0BCLR
B0BCLR
MOV
FTC1IEN
FTC1ENB
A,#20H
; To disable TC1 interrupt service
; To disable TC1 timer
;
B0MOV
MOV
B0MOV
B0MOV
TC1M,A
A,#74H
TC1C,A
TC1R,A
; To set TC1 clock = fcpu / 64
; To set TC1C initial value = 74H
; (To set TC1 interval = 10 ms)
; To set TC1R auto-reload register
B0BSET
B0BCLR
B0BSET
B0BSET
FTC1IEN
FTC1IRQ
FTC1ENB
ALOAD1
; To enable TC1 interrupt service
; To clear TC1 interrupt request
; To enable TC1 timer
; To enable TC1 auto-reload function.
SONiX TECHNOLOGY CO., LTD
Page 60
Revision 1.94