beautypg.com

Texas Instruments TLV1562 User Manual

Page 84

background image

Software Overview

78

SLAA040

DP = #AD_DP ;

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

* ADC_mono_con_Start:

* read samples and store them into memory

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

ADC_mono_con_Start:

repeat(#12)

NOP ; wait for t(SAMPLES) (450ns)

STEP6: @ADSAMPLE = port(ADC) ; read the new sample into the DSP

* IMPORTANT: fine–tune the counter number of the next repeat loop in order

* to achive maximum throughput related to the delay of the store instructions

STEP7: repeat(#7)

NOP ; wait for t(CONV1) (about 800ns)

STEP8: call STORE ; store the last sample into the table

goto STEP6 ; go back to receive next sample

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

* STORE:

* saving the samples into memory

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

STORE:

.if (SEND_OUT_PARALLEL)

* store sample into the parallel buffer location if chosen

port(DAC1) = @ADSAMPLE ; update DAC output

.endif

.if SAVE_INTO_MEMORY

* store new sample into DSP data memory

*AR7+ = data(@ADSAMPLE) ; write last sample into memory table

.endif

.if SEND_OUT_SERIAL

* store sample into the serial buffer location

DP = #00000h ; point to page zero

TC = bitf(@SPC,#01000h) ; test, is the XRDY Bit in SPC=1?

if (TC) goto SEND_SERIAL_END ; don’t send something until XDR is empty

; this has been included because the serial DAC TLC5618A is not able to understand

; endless data–stream (the CS should not become high before end of sending

; the 16th bit)

DP = #AD_DP ; reset Data page pointer to variables

A = @ADSAMPLE<<2 ; leftshift of the sample for a 12-bit format

@ADSAMPLE = A ;

@ADSAMPLE |= #(TLC5618_LATCH_A|TLC5618_FAST_MODE|TLC5618_POWER_UP) ; set the
mode of the DAC

data(BDXR) = @ADSAMPLE ; send out the sample to the serial DAC

SEND_SERIAL_END: