SN8P2740 Series
ADC, OP-amp, Comparator 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 65
Version 2.0
6.9 ADC INTERRUPT OPERATION
When the ADC converting successfully, the ADCIRQ will be set to
“1” no matter the ADCIEN is enable or disable. If the
ADCIEN and the trigger event ADCIRQ is set to be
“1”. As the result, the system will execute the interrupt vector. If
the ADCIEN = 0, the trigger event ADCIRQ is still set to be
“1”. Moreover, the system won‟t execute interrupt vector
even when the ADCIEN is set to be
“1”. Users need to be cautious with the operation under multi-interrupt situation.
Example: ADC interrupt request setup.
B0BCLR
FADCIEN
; Disable ADC interrupt service
MOV
A, #10110000B
;
B0MOV
ADM, A
; Enable P4.0 ADC input and ADC function.
MOV
A, #00000000B
; Set ADC converting rate = Fcpu/16
B0MOV
ADR, A
B0BSET
FADCIEN
; Enable ADC interrupt service
B0BCLR
FADCIRQ
; Clear ADC interrupt request flag
B0BSET
FGIE
; Enable GIE
B0BSET
FADS
; Start ADC transformation
Example: ADC interrupt service routine.
ORG
8
; Interrupt vector
JMP
INT_SERVICE
INT_SERVICE:
…
; Push routine to save ACC and PFLAG to buffers.
B0BTS1
FADCIRQ
; Check ADCIRQ
JMP
EXIT_INT
; ADCIRQ = 0, exit interrupt vector
B0BCLR
FADCIRQ
; Reset ADCIRQ
…
; ADC interrupt service routine
…
EXIT_INT:
…
; Pop routine to load ACC and PFLAG from buffers.
RETI
; Exit interrupt vector