Datasheet
LTC2410
45
TYPICAL APPLICATIO S
U
**********************************
* The next short loop waits for the *
* LTC2410's conversion to finish before *
* starting the SPI data transfer *
**********************************
*
CONVEND LDAA PORTD Retrieve the contents of port D
ANDA #%00000100 Look at bit 2
* Bit 2 = Hi; the LTC2410's conversion is not
* complete
* Bit 2 = Lo; the LTC2410's conversion is complete
BNE CONVEND Branch to the loop's beginning while bit 2 remains
high
*
*
********************
* The SPI data transfer *
********************
*
TRFLP1 LDAA #$0 Load accumulator A with a null byte for SPI transfer
STAA SPDR This writes the byte in 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 LTC2410 data
that was just received
STAA 0,X Transfer the LTC2410's data to memory
INX Increment the pointer
CPX #DIN4+1 Has the last byte been transferred/exchanged?
BNE TRFLP1 If the last byte has not been reached, then proceed to the
* next byte for transfer/exchange
BSET PORTD,Y %00100000 This sets the SS* output bit to a logic high,
* de-selecting the LTC2410
PULA Restore the A register
PULY Restore the Y register
PULX Restore the X register
RTS
Figure 56. This is an Example of 68HC11 Code That Captures the LTC2410’s
Conversion Results Over the SPI Serial Interface Shown in Figure 55