Texas Instruments TLV1562 User Manual

Page 89

Advertising
background image

Software Overview

83

Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP

@CR1_SEND ^= #RES_10_BIT ; clear bit for 10–Bit Resolution

@CR1_SEND |= #RES_4_BIT ; set 8–Bit conversion mode

.endif

.if (EXTERNAL_CLOCK)

@CR0_SEND ^= #CLK_INTERNAL ; clear CLK_INTERNAL bit if one

@CR0_SEND |= #CLK_EXTERNAL ; set CLK_EXTERNAL 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

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

* Calibration:

* do a calibration of the input if chosen (the location of this instruction

* is only for an EVM test, in practice, the calibration procedure should

* be executed when the inputs are shorted to the correct voltage and after

* calibration, the analog signal is to apply before doing any further signal

* conversion)

* the calibration implementation is more or less inserted as an example

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

.if (IME_CALIBRATION)

call CALIBRAT_INTERNAL_MID_SCALE

.endif

.if (SME_CALIBRATION)

call CALIBRAT_SYSTEM_MID_SCALE

.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

NOP ; wait for tW(CSH)=50ns

* write CR0

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

STEP1: port(DEACTIVE) = @ZERO ; deselect ADC (CS high)

STEP2: NOP ;

NOP ;

NOP ; wait for t(SAMPLE1)=100ns

* initialize longer waitstates:

DP = #00000h ; point to page zero

Advertising