
3
Serial Peripheral Interface (SPI)
The fastest and most efficient method of implementing a data transfer between the TLC2543 and a microcontroller is
to use the serial peripheral interface (SPI) of the microcontroller, if this is available.
The TMS370 (Texas Instruments), H8/300 (Hitachi) and MC68HC11 (Motorola) all offer SPIs (or the equivalent ) in
a subset of each of these families of microcontrollers. The H8/300 offers a serial communications interface (SCI) which
can be configured to operate in a similar way to that of the standard SPI’s offered by the TMS370 and MC68HC11.
The principle features of the SPI are:
• Simultaneous serial data input and output
• Synchronous operation
• Provision of frequency programmable serial clock
• Data transfer complete flag
Figure 4 shows the structure of the SPI. In this case the TMS370C010 is used to illustrate the main elements of the
interface.
Serial Input Buffer
(SPIBUF)
Shift Register
(SPIDAT)
SPI Master (Master/Slave = 1)
TMS370C010
SOMI
SOMO
SPICLK
TLC2543
DATA OUT
DATA INPUT
I/O CLOCK
MSB LSB
Figure 4. Serial Peripheral Interface – Internal Structure and Data Flow
The microcontroller can be configured by software to perform as the SPI master or slave. When operating as the master,
data is input to the SPI shift register (SPIDAT) via the slave out master in (SOMI) terminal. At the same time data is
output from the SPIDAT via the slave in master out (SIMO) terminal.
The SPI functions as follows. The SPIDAT should be loaded with the first byte of data to be sent. This automatically
initiates the transmission of this byte. During this transmission time data is received at the other end of the SPIDAT shift
register. The SPI INT FLAG is regularly checked. As soon as the last bit of the input data byte is received the SPI INT
FLAG is set to 1. This then signals that the received byte can be read from the serial input buffer (SPIBUF) and that the
SPIDAT is ready to accept
the next byte of data to be transmitted.
Additional SPI features which apply to the specific microcontrollers are described in their respective sections which
follow.
TLC2543 to SPI Interface Timing
The timing digram for the 16 clock transfer TLC2543 to SPI interface is shown in Figure 5. The channel select/mode
data is read into the TLC2543 on the positive going edges of the I/O clock and analog-to-digital conversion results are
read into the microcontroller on the negative going edges of the I/O clock.
Comentários a estes Manuais