beautypg.com

Texas Instruments TLV1562 User Manual

Page 67

background image

Software Overview

61

Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP

SERIAL_DAC_INI:

BSPI_INI:

DP = #0

@BSPC = #00038h ; reset SPI

@BSPCE = #00101h ; set clock speed, no Autobuffer Mode

@BSPC = #0C078h ; start serial port

.endif

.if (INT0_DRIVEN|POLLING_DRV)

* reset pending IRQs

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

.endif

.if INT0_DRIVEN

* enable Interrupt INT0

DP = #0

@IMR |= #01 ; allow INT0

.endif

* enable global interrupt (this is even required, if no IRQ routine is used

* by this program because the GoDSP debugger needs to do its backgroud interrupts)

INTM = 0 ; enable global IRQ

* initialize storage table for the ADC samples

AR7 = #(data_loc_A) ; point to first date location of the storage table

AR0 = #(num_data_A+data_loc_A); AR0 points to table end

DP = #AD_DP ;

@ADCOUNT= #(num_data_A) ; initialize ADCOUNT with the number of required samples

.if POLLING_DRV

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

.endif

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 = #(CH1|MONO_INT|SINGLE_END|CLK_INTERNAL|NO_CALIB_OP);

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

* change some of the possible modes by variation of the bit setting in the file header

* this next steps can be erased, if the user is running in only one special configuration

.if (R8BIT_RESOLUT)

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

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