Microprocessors: From Assembly Language to C Using thePIC18Fxx2

This chapter introduces serial IO in the form of asynchronous serial transfer using the Universal Synchronous Asynchronous Receiver Transmitter (USART) subsystem of the PIC18Fxx2. A serial interface using RS232 signaling is implemented for the PIC18F242 reference system, allowing character input/output via a serial port connection to a personal computer.
After reading this chapter, you will be able to:
Describe the differences between synchronous and asynchronous serial data transfer.
Draw the waveform for an asynchronous serial data transfer that includes a start bit, data bits, and stop bits.
Write C code that sends and receives asynchronous serial data via the USART subsystem of the PIC18Fxx2.
Implement a RS232-compatible interface for the PIC18F242.
Parallel IO uses a group of signals for data transfer, with a clock or data strobe signal typically used for controlling the transfer. Figure 9.1 a shows a 16-bit parallel IO link between CPU_a and CPU_b, with a clock signal used to perform one data transfer each clock cycle. The bandwidth of a communication channel is usually expressed as the number of bytes transferred per second (B/s), or the number of bits transferred per second (b/s). Please observe the capitalization difference between Bps (Bytes/second) and bps (bits/second); Bps is related to bps via the relationship Bps = bps/8. For Figure 9.1 a, the bandwidth is 600 MB/s (M = 10 6) if the clock frequency is 300 MHz, because 2 bytes are transferred each clock cycle. Data sent 1 bit...