Texas Instruments TLV1562 User Manual

Page 94

Advertising
background image

Software Overview

88

SLAA040

* initialize storage table for the ADC samples

DP = #AD_DP ;

A += #–1 ; decrement A

@CH_NO = A ; read number of sampling channel

A = @ADMEM

AR7 = A ; point to first date location of the storage table

A = @ADCOUNT ; AR0 points to table end

B = @ADMEM

A += B

AR0 = A ; AR0 is loaded with last save location

AR5 = #(IFR) ; AR5 points to the IFR register (only for polling mode)

DP = #AD_DP

@ZERO = #00000 ; set the dummy send value

* initialize the send values to set–up the two programmable register of the ADC

@CR0_SEND = #(MONO_INT|SINGLE_END|CLK_INTERNAL|NO_CALIB_OP);

A = @CR0_SEND

A |= @CH_NO

@CR0_SEND = A

@CR1_SEND = #(NO_SW_PWDN|NO_AUTO_PWDN|NO_2COMPLEMENT|NO_DEBUG|RES_10_BIT|CST_CONV_START);

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

* 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

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

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

NOP ;

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

* ADC_mono_IRQ_Start:

* read samples and store them into memory

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

Advertising