The UART stands for Universal Asynchronous Receiver/Transmitter and is an inbuilt IC within a microcontroller but not like a communication protocol (I2C & SPI). In UART, the communication between two devices can be done in two ways namely serial data communication and parallel data communication as shown below image.
UART: Serial and Parallel Communication
In the case of serial data communication, the data is transferred through a single cable or line in a bit-by-bit form and it requires just two cables. Serial data communication is not expensive in comparison with parallel communication. The circuit required is simple with minimum wires. This communication is very useful in compound circuits compared with parallel communication as shown below image:
In the case of parallel communication, the data is transferred through multiple cables at one time. It is fast but expensive since additional hardware and cables are required for it. Ex. RAM, PCI, old printers, etc.
Block Diagram of UART
- The diagram of UART comprises two components: transmitter and receiver. The transmitter consists of three blocks: transmit hold register, shift register, and control logic. The receiver consists of a receive hold register, shift register, and control logic. Both the transmitter and receiver sections have a baud rate generator in common. This generator provides speed to the transmitter and receiver section while transmitting or receiving data.
- The holding register in the transmitter consists of the data to be transmitted. The shift registers in the transmitter and receiver move the bits to the right or left till a byte is not completely transmitted or received. A read/write control logic is used to control the read/write operations.
There are two types of UARTS available: Transmitting UART and Receiving UART, where both communicate directly with each other. Two cables are required for their communication. The flow of data is from both the transmitting (Tx) or receiving (Rx) pins of the UART. This transmission can be done asynchronously (there is no CLK signal for synchronizing the o/p bits) In the case of parallel transmission, after receiving parallel data from the bus, it forms a data packet by the addition of three bits i.e. start, stops, and parity. It reads the data packet bit by bit and converts the received data into parallel form to eliminate the three bits of the data packet.
This bit is also known as a synchronization bit which is placed before the actual do. An inactive data transmission line is controlled at a high voltage level. For the data, transmission begins UART transmission drags the data line from high voltage to a low voltage. The obtaining JART recognizes this high to low-level transformation over the data line and also understands the data.
The stop bit is positioned at the end of the data packet. This bit is 2-bits lengthy but frequently on bit only utilized. To stop the broadcast the UART keeps the data line on high voltage.
This bit confirms whether the data obtained is right or not. Parity can be even or odd and is a fault-checking system. This bit is not widely used hence not compulsory.
Data bits or data frame:
The data bits include the actual data sent or received. The frame length of the data can be between 5 and 9. Generally, the LSB of the data to be transmitted is entered first.
1. UART requires only two wires for data communication.
2. It does not require a CLK signal.
3. It is provided with a parity bit for checking errors.
1. The data frame size is a maximum of 9 bits.
2. It cannot hold several slave/master systems.
3. every UART baud rate should be 10% of each other.
Applications of UART:
- Transmitting and receiving UARTS must be set for the same bit speed, character length, parity, and stop bits for proper operation.
- Very low-cost home computers or embedded systems dispense with a UART and use the CPU sample the state of an input port or directly manipulate an output port for data transmission.
- Typical serial ports used with personal computers connected to modems use eight data bits.