next up previous
Next: Input Capture Interrupts Up: lab12 Previous: Lab Objectives

Serial Communication Protocol

A protocol is an agreement between two parties about how the two parties should behave. A communication protocol is a protocol about how two parties should speak to each other. Serial communication protocols assume that bits are transmitted in series down a single channel. A serial protocol has to address the following issues

The IR link you'll be constructing is an asynchronous serial link and this means that these four issues must be agreed upon by both transmitter and receiver prior to sending any information.

In general, serial links transmit data in distinct packets or frames. A frame is a set of bits that are transmitted sequentially by the transmitter. In general the frame consists of four types of bits; a start bit, data bits, parity bits, and stop bits. The start bit is used to signal the beginning of a frame. The stop bit is used to signal the end of a frame. The data is contained in the data bits and the parity bit is an extra bit that is often used to detect transmission errors. In this lab, you'll use the MicroStamp11 to transmit a frame that consists of only start, data, and stop bits. You won't be using parity checking to detect transmission errors.

In many serial protocols, the issue of how to detect the start of a transmitted frame uses a special bit known as a start bit. Both transmitter and receiver assume that the channel is initially idle (i.e. zero volt logical level). The beginning of a frame is then signalled by setting the channel high for a specified length of time and then setting it low again. Transmission of data bits usually commences a specified interval of time after the falling edge of the start bit.

The issue of "when" to look for data bits in the frame must be agreed upon prior to establishing the link. Asynchronous serial protocols usually require that information bits be transmitted at regular time intervals. For instance if we have a 2400 kbaud modem, then both receiver and transmitter know that they should look for information bits arriving at a rate of 2400 thousand bits per second.

One possible way of formulating the protocol is to require that the first data bit occur a fixed time interval after the falling edge of the start bit. As a concrete example, let's assume that the data bits are always an integral multiple of 10 microseconds after the falling edge of the start bit. In this case, the receiver simply needs to look at the channel every 10 microseconds after it has identified the falling edge of the start bit. If the channel is high when the receiver looks, then we record a 1 and if the channel is idle, then we record a zero.

Once you've recovered a series of bits, there is a natural question concerning the order of the transmitted data bits. In other words if each transmission consists of a byte, then is the first data bit received the most or least significant bit of that byte. The receiver and transmitter need to agree upon the bit order prior to transmission so the data bits are properly interpreted.

We can use one or more stop bits to signal the end of a transmitted frame. The stop bits are generated by setting the channel to idle for 1 or more time intervals of $T$ duration. Another approach however, would simply count the number of received bits after the falling edge of the start bit.

To summarize, the serial protocol we recommend you use consists of the following agreements. In this protocol, the variable $T$ is a time interval agreed upon by the receiver and transmitter.

The timing diagram for this serial protocol is shown in figure 1.

Figure 1: Wireless Serial Protocol Timing Diagram

next up previous
Next: Input Capture Interrupts Up: lab12 Previous: Lab Objectives
Michael Lemmon 2009-02-01