SN8P1600
8-bit micro-controller
SONiX TECHNOLOGY CO., LTD
Page 60
Revision 1.94
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
FTC1IEN
B0BCLR
FTC1ENB
MOV
A,#20H
B0MOV
TC1M,A
MOV
A,#74H
B0MOV
TC1C,A
B0BSET
FTC1IEN
B0BCLR
FTC1IRQ
B0BSET
FTC1ENB
Example: Setup the TC1M and TC1C with auto-reload function.
B0BCLR
FTC1IEN
B0BCLR
FTC1ENB
MOV
A,#20H
B0MOV
TC1M,A
MOV
A,#74H
B0MOV
TC1C,A
B0MOV
TC1R,A
B0BSET
FTC1IEN
B0BCLR
FTC1IRQ
B0BSET
FTC1ENB
B0BSET
ALOAD1
; To disable TC1 interrupt service
; To disable TC1 timer
;
; To set TC1 clock = fcpu / 64
; To set TC1C initial value = 74H
;(To set TC1 interval = 10 ms)
; To enable TC1 interrupt service
; To clear TC1 interrupt request
; To enable TC1 timer
; To disable TC1 interrupt service
; To disable TC1 timer
;
; To set TC1 clock = fcpu / 64
; To set TC1C initial value = 74H
; (To set TC1 interval = 10 ms)
; To set TC1R auto-reload register
; To enable TC1 interrupt service
; To clear TC1 interrupt request
; To enable TC1 timer
; To enable TC1 auto-reload function.