Asynchronous Serial Communications

Asynchronous Serial Communications

Copyright: © 2017 |Pages: 18
DOI: 10.4018/978-1-68318-000-5.ch012
OnDemand PDF Download:
$30.00
List Price: $37.50

Chapter Preview

Top

Data Packet

Since data is transmitted asynchronously, it is framed between the so-called START and STOP bits as illustrated in Figure 1. Initially, the transmission line is idle high, that is to say, when no data is being transmitted the line’s logic level is high. To initiate transmission, the data must be written to a transmit register (TXREGx). The EUSART drops the line (logic low) for one bit duration known as the start bit. This indicates to the receiver that a byte of data is being transmitted and hence it starts to sample the upcoming data bits. The transmitted information may be a byte or a 9-bit word. The 9th bit, called P in the figure, may be part of the data or it may simply be the parity bit used for error detection. The frame is terminated with the stop bit which is a logic high level for one time slot. The stop bit followed by the start bit creates a falling edge to indicate to the receiver that new data will be transmitted.

Figure 1.

One EUSART data packet, asynchronous mode

The baud rate is 1/T where T is the bit duration. The bit rate is the actual transmission rate excluding the START, STOP and Parity bits. Figure 1 shows that if data is transmitted continuously or “back-to-back”, the bit rate would be eight eleventh of the baud rate and hence the channel efficiency (Bit Rate / Baud Rate) is about 73%. Note that the parity bit is optional and is usually excluded. In this case, the channel efficiency is 80% at its best.

Top

Eusart Transmit Block

The transmit block diagram of Figure 2 shows that TXEN must be set to enable the clock of the Transmit Shift Register TSR. In order to configure TXx as a serial port pin, SPEN must be set. The baud rate is specified by writing to SPBRGx in the Baud Rate Generator (BRG) block in accordance with the formulas listed in Table 1.

Figure 2.

EUSART transmit block diagram; TX1/2 is pin RC6/RD6 (EUSART1/2).

Table 1.
Baud rate formulas, 8-bit uses SPBRGx only, 16-bit uses SPBRGHx:SPBRGx

Control bit BRGH (High Baud Rate Select), in the Transmit Status and Control register (TXSTAx), selects between low baud rates (BRGH = 0) and high ones (BRGH = 1). Note that the numerical values obtained by any of the formulas of Table 1 must be rounded.

Complete Chapter List

Search this Book:
Reset