SN8P26L38
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 75
Version 1.5
6.13
UART INTERRUPT OPERATION
When the UART transmitter successfully, the RXIRQ/TXIRQ will be set to
“1” no matter the RXIEN/TXIEN is enable or
disable. If the RXIEN/TXIEN and the trigger event RXIRQ/TXIRQ is set to be
“1”. As the result, the system will
execute the interrupt vector. If the RXIEN/TXIEN = 0, the trigger event RXIRQ/TXIRQ is still set to be
“1”. Moreover,
the system won
’t execute interrupt vector even when the RXIEN/TXIEN is set to be “1”. Users need to be cautious with
the operation under multi-interrupt situation.
Example: UART receive and transmit interrupt request setup.
B0BSET
FRXIEN
; Enable UART receive interrupt service
B0BCLR
FRXIRQ
; Clear UART receive interrupt request flag
B0BSET
FTXIEN
; Enable UART transmit interrupt service
B0BCLR
FTXIRQ
; Clear UART transmit interrupt request flag
B0BSET
FGIE
; Enable GIE
Example: UART receive interrupt service routine.
ORG
8
; Interrupt vector
JMP
INT_SERVICE
INT_SERVICE:
…
; Push routine to save ACC and PFLAG to buffers.
B0BTS1
FRXIRQ
; Check RXIRQ
JMP
EXIT_INT
; RXIRQ = 0, exit interrupt vector
B0BCLR
FRXIRQ
; Reset RXIRQ
…
; UART receive interrupt service routine
…
EXIT_INT:
…
; Pop routine to load ACC and PFLAG from buffers.
RETI
; Exit interrupt vector