SN8P2200 Series
USB 1.1 Low-Speed 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 66
Version 1.7
6.9
USB INTERRUPT OPERATION
When the USB process finished, the USBIRQ will be set to “1” no matter the USBIEN is enable or disable. If the
USBIEN and the trigger event USBIRQ is set to be “1”. As the result, the system will execute the interrupt vector. If
the USBIEN = 0, the trigger event USBIRQ is still set to be “1”. Moreover, the system won’t execute interrupt vector
even when the USBIEN is set to be “1”. Users need to be cautious with the operation under multi-interrupt situation.
¾
Example: USB interrupt request setup.
B0BCLR
FUSBIEN
; Disable USB interrupt service
B0BCLR
FUSBENB
; Disable USB timer
B0BCLR
FUSBIRQ
; Clear USB interrupt request flag
B0BSET
FUSBIEN
; Enable USB interrupt service
…
; USB initialize.
…
; USB operation.
B0BSET
FUSBENB
; Enable USB timer
B0BSET
FGIE
; Enable GIE
¾
Example: USB interrupt service routine.
ORG
8
; Interrupt vector
JMP
INT_SERVICE
INT_SERVICE:
PUSH
; Push routine to save ACC and PFLAG to buffers.
B0BTS1
FUSBIRQ
; Check USBIRQ
JMP
EXIT_INT
; USBIRQ = 0, exit interrupt vector
B0BCLR FUSBIRQ
;
Reset
USBIRQ
…
; USB interrupt service routine
…
EXIT_INT:
POP
; Pop routine to load ACC and PFLAG from buffers.
RETI
; Exit interrupt vector