Texas Instruments TLV1562 User Manual

Page 55

Advertising
background image

Software Overview

49

Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP

* reset pending IRQs

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

.endif

.if INT0_DRIVEN

* enable Interrupt INT0

@IMR |= #01 ; allow INT0

.endif

* enable global interrupt (this is required even 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|RD_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

.elseif (R4BIT_RESOLUT)

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

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

.endif

.if (EXTERNAL_CLOCK)

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

@CR0_SEND |= #CLK_EXTERNAL ; set CLK_EXTERNAL mode

.endif

Advertising