beautypg.com

Texas Instruments TLV1562 User Manual

Page 95

background image

Software Overview

89

Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP

ADC_mono_IRQ_Start:

ISTEP2: XF = 0 ; clear CSTART

ISTEP3: NOP

NOP

NOP ; wait for TW(CSTARTL)

ISTEP4: XF = 1 ; set CSTART

STEP5:

* wait until INT– goes low in polling the INT0 pin:

M1: TC = bit(*AR5,15–0) ; test, is the INT0 Bit in IFR=1?

if (NTC) goto M1 ; wait until INT– signal went high

IFR = #1 ; reset any old interrupt on pin INT0

* read sample

STEP2: XF = 0 ; clear CSTART

STEP10: @ADSAMPLE = port(ADC) ; read the new sample into the DSP

STEP4: XF = 1 ; wait for TW(CSTARTL) and set CSTART

**********************************

* STORE:

* saving the samples into memory

**********************************

STORE:

* store new sample into DSP data memory

*AR7+ = data(@ADSAMPLE) ; write last sample into memory table

* test for table end, set pointer back if true

TC = (AR0 ==AR7) ; is AR0 = AR7? (table end reached?)

if (NTC) goto STORE_END ;

* finish conversion

CPL = #1 ; do stack pointer addressing

AR7 = pop() ; restore AR7

AR6 = pop() ; restore AR6

A = #0 ; clear ACCU

RETURN ; jump back to C–layer

STORE_END:

goto STEP5 ; go back to receive next sample

**************************************************************

* IRQ_INT0:

* Interrupt routine of the external interrupt input pin INT0

**************************************************************

IRQ_INT0:

return_enable ; return from IRQ (wake up from the IDLE mode)

**************************************************************************

* BXINT0:

* Interrupt routine of the serial transmit interrupt of the buffered SPI

**************************************************************************