Sd16 interrupt handling software example – Texas Instruments MSP430x4xx User Manual

Page 420

Advertising
background image

SD16 Operation

21-17

SD16

SD16 Interrupt Handling Software Example

The following software example shows the recommended use of SD16IV and
the handling overhead. The SD16IV 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:

-

SD16OVIFG, CH0 SD16IFG, CH1 SD16IFG

16 cycles

-

CH2 SD16IFG

14 cycles

The interrupt handler for channel 2 SD16IFG shows a way to check
immediately if a higher prioritized interrupt occurred during the processing of
the ISR. This saves nine cycles if another SD16 interrupt is pending.

; Interrupt handler for SD16.

INT_SD16

; Enter Interrupt Service Routine

6

ADD

&SD16IV,PC; Add offset to PC

3

RETI

; Vector 0: No interrupt

5

JMP

ADOV

; Vector 2: ADC overflow

2

JMP

ADM0

; Vector 4: CH_0 SD16IFG

2

JMP

ADM1

; Vector 6: CH_1 SD16IFG

2

;

; Handler for CH_2 SD16IFG starts here. No JMP required.

;

ADM2

MOV

&SD16MEM2,xxx

; Move result, flag is reset

...

; Other instruction needed?

JMP

INT_SD16

; Check other int pending

2

;

; Remaining Handlers

;

ADM1

MOV

&SD16MEM1,xxx

; Move result, flag is reset

...

; Other instruction needed?

RETI

; Return

5

;

ADM0

MOV

&SD16MEM0,xxx

; Move result, flag is reset

RETI

; Return

5

;

ADOV

...

; Handle SD16MEMx overflow

RETI

; Return

5

Advertising