English
Language : 

SN8P1700 Datasheet, PDF (71/145 Pages) SONiX Technology Company – 8-Bit Micro-Controller
SN8P1700
8-bit micro-controller build-in 12-bit ADC
T0 BASIC TIMER OPERATION SEQUENCE
The T0 basic timer’s sequence of operation can be following.
Set the T0C initial value to setup the interval time.
Set the T0ENB to be “1” to enable T0 basic timer.
T0C is incremented by one with each clock pulse which frequency is corresponding to T0M selection.
T0C overflow when T0C from FFH to 00H.
When T0C overflow occur, the T0IRQ flag is set to be “1” by hardware.
Execute the interrupt service routine.
Users reset the T0C value and resume the T0 timer operation.
Example: Setup the T0M and T0C.
B0BCLR
B0BCLR
MOV
B0MOV
MOV
B0MOV
B0BSET
B0BCLR
B0BSET
FT0IEN
FT0ENB
A,#20H
T0M,A
A,#74H
T0C,A
FT0IEN
FT0IRQ
FT0ENB
; To disable T0 interrupt service
; To disable T0 timer
;
; To set T0 clock = fcpu / 64
; To set T0C initial value = 74H (To set T0 interval = 10 ms)
; To enable T0 interrupt service
; To clear T0 interrupt request
; To enable T0 timer
Example: T0 interrupt service routine.
ORG
JMP
INT_SERVICE:
8
INT_SERVICE
B0XCH
PUSH
A, ACCBUF
B0BTS1
JMP
FT0IRQ
EXIT_INT
EXIT_INT:
B0BCLR
MOV
B0MOV
.
.
JMP
.
.
POP
B0XCH
FT0IRQ
A,#74H
T0C,A
.
.
EXIT_INT
.
.
A, ACCBUF
RETI
; Interrupt vector
; B0XCH doesn’t change C, Z flag
; Push
; Check T0IRQ
; T0IRQ = 0, exit interrupt vector
; Reset T0IRQ
; Reload T0C
; T0 interrupt service routine
; End of T0 interrupt service routine and exit interrupt vector
; Pop
;Restore ACC value
; Exit interrupt vector
SONiX TECHNOLOGY CO., LTD
Page 71
Revision 1.94