Texas Instruments TLV1562 User Manual

Page 61

Advertising
background image

Software Overview

55

Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP

nop ; wait for 34 cycles until conversion has been finished

@TEMP = port(ADC) ; read the sample but don’t care about the content

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

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

* set back ADC register CR0/CR1

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

* write CR1 (to reset old CSTART mode initialization, because otherwise, the ADC never resets

* the 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

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

NOP ; wait for tW(CSH)=50ns

* write CR0

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

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

NOP ; wait for tW(CSH)=50ns

return ; return from call

.endif

.if (SME_CALIBRATION)

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

* CALIBRAT_SYSTEM_MID_SCALE

* performs an internal calibration of the ADC to offset for the device midscale

* error and input offset

* basic idea: do a error calibration in mono interrupt driven mode using CSTART

* for conversion, but use the channel & single/differential input information already

* set–up in the CR0_send register from

************************************************************************************
CALIBRAT_SYSTEM_MID_SCALE:

DP = #AD_DP ; initialize data pointer

* clear calibration related bits in CR0:

@CR0_SEND &= #(NO_CALIB_OP^0FFFFh) ; clear bit for no calibration use

@CR0_SEND &= #(CALIB_OP^0FFFFh) ; clear bit for no calibration use

* initialize the send values to setup the two programmable registers of the ADC to calibrate

data(CR_CALIBRA) = @CR0_SEND ; load help register with CR0 content

Advertising