PadhaikoAll subjects

Past exam question: Assignment 3, Q15

Instrumentation · 5 marks

Open in the Padhaiko app

Topic: Connectivity Technology in Instrumentation System

Question

Explain UART in detail with example.

Solution

What is UART and Hardware Connection: UART (Universal Asynchronous Receiver-Transmitter) is a hardware communication peripheral that transmits and receives serial data asynchronously without a shared clock line. Two UART devices cross-connect their transmit and receive pins (TX RX and RX TX) with a common GND. Because there is no clock wire, both sides must be pre-configured to the exact same baud rate (commonly or ) and frame format (e.g., 8N1: 8 data bits, No parity, 1 stop bit).

UART Cross-Connection and Data Frame Format (8N1)Text
+------------+ TX ----------> RX +------------+
| Transmitting|                  | Receiving  |
|    UART    | RX <---------- TX |    UART    |
+------------+                   +------------+
                     GND ---- GND

Frame Format (Idle HIGH -> Start LOW -> D0..D7 LSB first -> [Parity] -> Stop HIGH):
  Idle  | Start | D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | Parity | Stop | Idle
  HIGH  |   0   | b0 | b1 | b2 | b3 | b4 | b5 | b6 | b7 |  (opt) |  1   | HIGH

Five Steps of UART Data Transmission:

  1. Parallel Load: The transmitting UART receives a parallel byte (e.g., 8 bits) from the CPU/microcontroller data bus.
  2. Framing: It adds a Start bit (0), optional Parity bit (for single-bit error detection), and Stop bits (1) around the data bits.
  3. Serial Shift-Out: It shifts the frame out bit-by-bit (LSB first) on the TX line at the configured baud rate; the receiving UART detects the falling edge of the Start bit and samples each bit at mid-bit intervals.
  4. Deframing: The receiving UART verifies parity/stop bits and strips the Start, Parity, and Stop bits.
  5. Parallel Read: It converts the serial bits back into a parallel byte and places it on its receive buffer/data bus (flagging RX ready).

Practical Example (Arduino Sensor Telemetry over UART): Sending the ASCII character 'A' (0x41 = 0100 0001) in 8N1 format at transmits the 10-bit sequence: 0 (Start) + 1 0 0 0 0 0 1 0 (LSB-first 0x41) + 1 (Stop).

Arduino Example: Transmitting Sensor Readings via UARTC
void setup() {
  Serial.begin(9600);    // Configure hardware UART at 9600 bps, 8N1
}

void loop() {
  int adcVal = analogRead(A0);
  Serial.print("Sensor ADC = ");
  Serial.println(adcVal); // Sends framed ASCII bytes over TX (PD1)
  delay(500);
}
Answer:

UART is an asynchronous, full-duplex, 2-wire (TX/RX) serial protocol where both devices agree on a common baud rate and frame structure (Start bit + Data bits + optional Parity + Stop bits). The transmitter converts parallel bytes into framed serial bits and shifts them out LSB-first; the receiver synchronizes on the Start bit, samples the data bits, strips framing bits, and reconstructs the parallel byte (e.g., Serial.begin(9600) streaming ADC readings to a PC).

All past exam questions for Instrumentation