Introduction to Microcontrollers Lab Manual - Microchip
Introduction to Microcontrollers Lab Manual - Microchip
Introduction to Microcontrollers Lab Manual - Microchip
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
8.2.7 Serial Peripheral Interface (SPI)<br />
SPI was created by Mo<strong>to</strong>rola. The SPI bus, also referred <strong>to</strong> as the “four wire” bus, is a<br />
single master multiple slave full duplex synchronous serial interface. The SPI operates<br />
with a single master and one or more slave devices. Only one device can talk <strong>to</strong> the<br />
master at any given time. Therefore, a chip select or “Slave Select (SS)” is required<br />
from the master <strong>to</strong> each slave device. When more the one slave device is connected<br />
<strong>to</strong> the SPI bus, these slave devices are required <strong>to</strong> tri-state their MISO output when<br />
they are not selected. Devices without tri-state outputs cannot share an SPI bus and<br />
therefore can only be used in a single slave configuration.<br />
The master pulls the Slave Select Low for the desired Slave device and sends a bit on<br />
the MOSI line. The master must then wait if the slave device requires a wait period,<br />
which is often the case for Analog-<strong>to</strong>-Digital Converters.<br />
Next, the master issues clock cycles. A full duplex transmission occurs during each<br />
clock cycle. The master drives the clock line high. On the rising edge of the clock, the<br />
slave reads in the bit on the MOSI line and shifts out the MSB from its shift register on<strong>to</strong><br />
the MISO line. The master drives the clock low and reads the MISO line and places its<br />
next bit on the MOSI line. The master drives the clock high and the clock cycle repeats.<br />
Note: The master must clock in an extra eight dummy bits <strong>to</strong> read the last eight bits<br />
from the slave.<br />
FIGURE 8-1: SIMPLIFIED SPI SYSTEM<br />
FIGURE 8-2: GENERIC SPI TIMING<br />
2011 <strong>Microchip</strong> Technology Inc. DS51963A-page 59