28
LTC1417
sn1417 1417fas
TYPICAL APPLICATIONS
U
Listing B
*************************************************************************
* *
* This example program selects a DG408 MUX channel using parallel *
* port C, initiates a conversion, and retrieves data from the LTC1417. *
* It stores the 14-bit, right justified data in two consecutive memory *
* locations. *
* *
*************************************************************************
*
*****************************************
* 68HC11 register definitions *
*****************************************
*
PIOC EQU $1002 Parallel I/O control register
* “STAF,STAI,CWOM,HNDS, OIN, PLS, EGA,INVB”
PORTC EQU $1003 Port C data register
* “Bit7,Bit6,Bit5,Bit4,Bit3,Bit2,Bit1,Bit0”
DDRC EQU $1007 Port D data direction register
* “Bit7,Bit6,Bit5,Bit4,Bit3,Bit2,Bit1,Bit0”
* 1 = output, 0 = input
PORTD EQU $1008 Port D data register
* “ - , - , SS* ,CSK ;MOSI,MISO,TxD ,RxD “
DDRD EQU $1009 Port D data direction register
SPCR EQU $1028 SPI control register
* “SPIE,SPE ,DWOM,MSTR;SPOL,CPHA,SPR1,SPR0”
SPSR EQU $1029 SPI status register
* “SPIF,WCOL, - ,MODF; - , - , - , - “
SPDR EQU $102A SPI data register; Read-Buffer; Write-Shifter
*
* RAM variables to hold the LTC1417’s 14 conversion result
*
DIN1 EQU $00 This memory location holds the LTC1417’s bits 13 - 08
DIN2 EQU $01 This memory location holds the LTC1417’s bits 07 - 00
MUX EQU $02 This memory location holds the MUX address data
*
*****************************************
* Start GETDATA Routine *
*****************************************
*
ORG $C000 Program start location
INIT1 LDAA #$03 0,0,0,0,0,0,1,1
* “STAF=0,STAI=0,CWOM=0,HNDS=0, OIN=0, PLS=0, EGA=1,INVB=1”
STAA PIOC Ensures that the PIOC register’s status is the same
* as after a reset, necessary of simple Port D manipulation
LDAA #$47 0,1,0,0,0,1,1,1
* “Bit7=input,Bit6=output,- ,- ,- ,Bit2=output,Bit1=output,
* Bit0=output”
* Bit7 used for BUSY input
* Bit6 used for CONVST signal output
* Bits 2 - 0 are used for the MUX address
STAA DDRC Direction of PortD’s bit are now set
LDAA #$2F -,-,1,0;1,1,1,1
* -, -, SS*-Hi, SCK-Lo, MOSI-Hi, MISO-Hi, X, X
STAA PORTD Keeps SS* a logic high when DDRD, Bit5 is set
LDAA #$38 -,-,1,1;1,0,0,0
STAA DDRD SS* , SCK, MOSI are configured as Outputs
* MISO, TxD, RxD are configured as Inputs
* DDRD’s Bit5 is a 1 so that port D’s SS* pin is a general output
LDAA #$50
STAA SPCR The SPI is configured as Master, CPHA = 0, CPOL = 0
* and the clock rate is E/2
* (This assumes an E-Clock frequency of 4MHz. For higher
29
LTC1417
sn1417 1417fas
TYPICAL APPLICATIONS
U
* E-Clock frequencies, change the above value of $50 to a
* value that ensures the SCK frequency is 2MHz or less.)
GETDATAPSHX
PSHY
PSHA
*
*****************************************
* Setup indecies *
*****************************************
*
LDX #$0 The X register is used as a pointer to the memory
* locations that hold the conversion data
LDY #$1000
*
*****************************************
* Initialize the LTC1417’s CONVST input *
* to a logic high before a conversion *
* start *
*****************************************
*
BSET PORTC,Y %01000000 This sets PORTC, Bit6 output to a logic
* high, forcing CONVST to a logic high
*
*****************************************
* Retrieve the MUX address from memory *
* and send it to the DG408 *
*****************************************
*
LDAA PORTC Capture the contents of PortC
ORAA MUX “Add” the MUX address
STAA PORTC Select the MUX channel
*
*****************************************
* Initiate a LTC1417 conversion *
*****************************************
*
BCLR PORTC,Y %01000000 This sets PORTC, Bit6 output to a logic
* low, initiating a conversion
BSET PORTC,Y %01000000 This resets PORTC, Bit6 output to a logic
* high, returning CONVST to a logic high
*
*****************************************
* The next short loop ensures that the *
* LTC1417’s conversion is finished *
* before starting the SPI data transfer *
*****************************************
*
CONVENDLDAA PORTC Retrieve the contents of port D
ANDA #%10000000 Look at Bit7
* Bit7 = Hi; the LTC1417’s conversion is complete
* Bit7 = Lo; the LTC1417’s conversion is not
* complete
BPL CONVEND Branch to the loop’s beginning while Bit7
* remains high
*
*************************************************************************
* This routine sends data to the LTC1417 and sets its MUX channel. The *
* very first time this routine is entered produces invalid data. Each *
* time thereafter, the data will correspond to the previous active *
* CONVST signal sent to the LTC1417. *
*************************************************************************
*
30
LTC1417
sn1417 1417fas
TYPICAL APPLICATIONS
U
BCLR PORTD,Y %00100000 This sets the SS* output bit to a logic
* low, selecting the LTC1417
TRFLP1 LDAA #$0 Load accumulator A with a null byte for SPI transfer
STAA SPDR This writes the byte into the SPI data register and
* starts the transfer
WAIT1 LDAA SPSR This loop waits for the SPI to complete a serial
* transfer/exchange by reading the SPI Status Register
BPL WAIT1 The SPIF (SPI transfer complete flag) bit is the SPSR’s
* MSB and is set to one at the end of an SPI transfer. The
* branch will occur while SPIF is a zero.
LDAA SPDR Load accumulator A with the current byte of LTC1417 data
* that was just received
STAA 0,X Transfer the LTC1417’s data to memory
INX Increment the pointer
CPX #DIN2+1Has the last byte been transferred/exchanged?
BNE TRFLP1 If the last byte has not been reached, then proceed to
* the next byte for transfer/exchage
BSET PORTD,Y %00100000 This sets the SS* output bit to a logic
* high, de-selecting the LTC1417
LDD DIN1 Load the contents of DIN1 and DIN2 into the double
* accumulator D
LSRD
LSRD Two logical shifts to right justify the 14-bit
* conversion results
STD DIN1 Return right justified data to memory
PULA Restore the A register
PULY Restore the Y register
PULX Restore the X register
RTS
CONVST
BUSY
SCLK
D
OUT
RD
MUX
DATA
CH5
CH3 DATACH2 DATACH1 DATACH0 DATA
CH0 CH1 CH2 CH3
1417 F24
Figure 24. Using the Sample Program In Listing 2, the LTC1417, Combined with the DG408 8-Channel MUX,
Has No Latency Between the Selected Input Voltage and Its Conversion Data as Shown In the Timing Relationship Above

LTC1417IGN#TRPBF

Mfr. #:
Manufacturer:
Analog Devices Inc.
Description:
Analog to Digital Converters - ADC L Pwr 14-B, 400ksps Smpl ADC Conv w/ Ser
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union