Texas Instruments TLV1562 User Manual

Page 56

Advertising
background image

Software Overview

50

SLAA040

.if (AUTO_PWDN_ENABLE)

@CR1_SEND ^= #NO_AUTO_PWDN ; clear NO_AUTO_PWDN bit if one

@CR1_SEND |= #AUTO_PWDN ; set AUTO_PWDN mode

.endif

.if (DIFF_INPUT_MODE)

@CR0_SEND ^= #SINGLE_END ; clear single ended input bit if one

@CR0_SEND |= #DIFFERENTIAL ; set differential input mode

.endif

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

* ADC_INI:

* set ADC register CR0/CR1

****************************
ADC_INI:

* write CR1:

port(ADC) = @CR1_SEND ; Address decoder sets CS low,

; WR low and send CR1 value to the ADC

port(DEACTIVE) = @ZERO ; deselect ADC (CShigh)

NOP ; wait for tW(CSH)=50ns

* write CR0

port(ADC) = @CR0_SEND ; send CR0 value to the ADC

port(DEACTIVE) = @ZERO ; deselect ADC (CShigh)

NOP ; wait for tW(CSH)=50ns

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

* ADC_mono_IRQ_Start:

* read samples and store them into memory

*******************************************
ADC_mono_IRQ_Start:

STEP2: @TEMP = port(ADC) ; select ADC (CS low) (change address bus signal)

STEP3: repeat(#4)

NOP ; wait for tD(CSL–SAMPLE)+1SYSCLK=6

STEP4: XF = 0 ; clear RD

STEP5:

.if POLLING_DRV

* 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 goes high

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

.elseif INT0_DRIVEN

* user main program area (this could execute additional code)

* go into idle state until the INT0 wakes the processor up

USER_MAIN: IDLE(2) ; the user software could do something else here

goto USER_MAIN ;

Advertising