SN8P1600
8-bit micro-controller
ꢃ
Example: TC1 interrupt service routine without auto-reload function.
ORG
JMP
8
; Interrupt vector
INT_SERVICE
INT_SERVICE:
B0XCH
B0MOV
B0MOV
A, ACCBUF
A, PFLAG
PFLAGBUF, A
; B0XCH doesn’t change C, Z flag
; Save PFLAG register in a buffer
B0BTS1
JMP
FTC1IRQ
EXIT_INT
; Check TC1IRQ
; TC1IRQ = 0, exit interrupt vector
B0BCLR
MOV
B0MOV
.
FTC1IRQ
A,#74H
TC1C,A
.
; Reset TC1IRQ
; Reload TC1C
; TC1 interrupt service routine
.
.
JMP
EXIT_INT
; End of TC1 interrupt service routine and exit interrupt
vector
.
.
.
.
EXIT_INT:
B0MOV
B0MOV
B0XCH
A, PFLAGBUF
PFLAG, A
A, ACCBUF
; Restore PFLAG register from buffer
; B0XCH doesn’t change C, Z flag
RETI
; Exit interrupt vector
ꢃ
Example: TC1 interrupt service routine with auto-reload.
ORG
JMP
8
; Interrupt vector
INT_SERVICE
INT_SERVICE:
B0XCH
B0MOV
B0MOV
A, ACCBUF
A, PFLAG
PFLAGBUF, A
; B0XCH doesn’t change C, Z flag
; Save PFLAG register in a buffer
B0BTS1
JMP
FTC1IRQ
EXIT_INT
; Check TC1IRQ
; TC1IRQ = 0, exit interrupt vector
B0BCLR
FTC1IRQ
; Reset TC1IRQ
.
.
; TC1 interrupt service routine
.
.
JMP
EXIT_INT
; End of TC1 interrupt service routine and exit interrupt
vector
.
.
.
.
EXIT_INT:
B0MOV
B0MOV
B0XCH
A, PFLAGBUF
PFLAG, A
A, ACCBUF
; Restore PFLAG register from buffer
; B0XCH doesn’t change C, Z flag
RETI
; Exit interrupt vector
SONiX TECHNOLOGY CO., LTD
Page 61
Revision 1.94