The Motorola 68HC11 has two types of serial interface subsystems. These are the synchronous serial (SPI) and the asynchronous serial interfaces (SCI). The SCI subsystem was discussed in the preceding section. This section covers the SPI subsystem. In both cases, the SPI and SCI systems transmit/receive digital data as a series of pulses (bits). The difference between these two approaches rests with how these pulses are clocked.
In order for the receiver to know when to look for a pulse on the data line, some agreement has to be made regarding the rate at which pulses are sent. In other words, the transmitter and receiver must agree upon the rate at which data is being transmitted. The difference between the SCI and SPI protocols lies in how the transmitter and receiver reach this agreement about baud rate.
The asynchronous serial interface (SCI) is the protocol
that your MicroStamp11 uses to communicate with the PC or
the LCD display module (BPI-216). For SCI communication,
the receiver and transmitter agree upon a specified baud
rate prior to connecting. So in MicroStamp11 programs
you'll find the baud rate set in the initialization routine
init() when we specify what goes in the
control register. In communicating with a host PC, the
baud rate was set to 38 kbaud. This value had to be set
both in the Hyperterm program as well as the MicroStamp11.
With this agreement the MicroStamp11 will always transmit
data at 38 thousand bytes per second and the PC will always
look for bit pulses at the time interval consistent with
that baud rate. If, for some reason, the transmitter
begins sending pulses at a different rate, then the
receiver won't know of the change. The receiver will
continue looking for data at the 38 kbaud rate and the
resulting message will be garbled because the receiver is
reading the bits at the wrong times.
The synchronous serial interface (SPI) is a serial protocol in which clocking information is transmitted along with the data signal. We usually think of the MicroStamp11 as the master and the other system as the slave. Typically the master device creates the clock and the slave device uses the master's clock to shift data into or out of itself. This means that the SPI serial channel needs a minimum of two lines. The primary two lines are sometimes referred to as the data and clock lines. The data line actually has the data bits and the clock line carries clock pulses indicating when the slave is to read/write the data bits. In other words, the slave doesn't need to have a clock, since it is using the master's clock. The value of this approach is that the slave can be rather simple. The disadvantage is that we need additional control lines.