beautypg.com

Texas Instruments TLV1562 User Manual

Page 76

background image

Software Overview

70

SLAA040

.if (EXTERNAL_CLOCK)

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

@CR0_SEND |= #CLK_EXTERNAL ; set CLK_EXTERNAL mode

.endif

.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

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

* Calibration:

* do a calibration of the input if choosen (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 (to reset old CSTART mode initialization, because otherwise, the ADC never sets

* back its INT pin to show a sample is available:

@CR_PROBLEM = #(SW_PWDN|NO_AUTO_PWDN|NO_2COMPLEMENT|NO_DEBUG|RES_10_BIT|RD_CONV_START);

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

; WR– low and send CR_PROBLEM value to the ADC

NOP ; wait for tW(CSH)=50ns

* write CR1:

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

; WR– low and send CR1 value to the ADC