Texas Instruments MSP430x1xx User Manual page 377

Texas instruments modules and peripherals user's guide
Table of Contents

Advertisement

ADC12 Interrupt Handling Software Example
The following software example shows the recommended use of ADC12IV
and the handling overhead. The ADC12IV value is added to the PC to
automatically jump to the appropriate routine.
The numbers at the right margin show the necessary CPU cycles for each
instruction. The software overhead for different interrupt sources includes
interrupt latency and return-from-interrupt cycles, but not the task handling
itself. The latencies are:
-
-
The interrupt handler for ADC12IFG15 shows a way to check immediately if
a higher prioritized interrupt occurred during the processing of ADC12IFG15.
This saves nine cycles if another ADC12 interrupt is pending.
; Interrupt handler for ADC12.
INT_ADC12
;
; Handler for ADC12IFG15 starts here. No JMP required.
;
ADM15
;
;
;
ADM0
;
ADTOV
;
ADOV
ADC12IFG0 - ADC12IFG14, ADC12TOV and ADC12OV
ADC12IFG15
; Enter Interrupt Service Routine
ADD
&ADC12IV,PC; Add offset to PC
RETI
; Vector 0: No interrupt
JMP
ADOV
; Vector 2: ADC overflow
JMP
ADTOV
; Vector 4: ADC timing overflow
JMP
ADM0
; Vector 6: ADC12IFG0
...
; Vectors 8-32
JMP
ADM14
; Vector 34: ADC12IFG14
MOV &ADC12MEM15,xxx ; Move result, flag is reset
...
JMP INT_ADC12
ADC12IFG14-ADC12IFG1 handlers go here
MOV &ADC12MEM0,xxx ; Move result, flag is reset
...
RETI
...
RETI
...
RETI
ADC12 Operation
; Other instruction needed?
; Check other int pending
; Other instruction needed?
; Return
; Handle Conv. time overflow
; Return
; Handle ADCMEMx overflow
; Return
ADC12
16 cycles
14 cycles
6
3
5
2
2
2
2
2
5
5
5
17-19

Advertisement

Table of Contents
loading

Table of Contents