Serial Communication Calculation and Programming using 8051 Microcontroller
Computer transfer data in two different ways:-
- Serial transfer: In serial transfer, data is transfer to device located many meters away this method is used for long distance data transfer.
- Parallel transfer: In parallel transfer, data is transferred in 8 or more lines. In this wire conductor is used for transferring data to a device that is only a few feet away.
Let’s see the block diagram of serial data transfer:
Let’s see the block diagram of parallel data transfer:
Serial communication is mostly used for transmitting and receiving the signal. The 8051 microcontroller is consisting of Universal Asynchronous Receiver Transmitter (UART) used for serial communication. The signals are transmitted and received by the Rx and Tx pins of microcontroller.
The UART take individual bytes of data and sends the individual bits in a sequential manner. The registers are used for collecting and storing the data inside a memory. UART is based on half-duplex protocol. Half-duplex means transferring and receiving the data, but not at the same time.
Let’s see the block diagram representation of showing serial communication between flash memory and 8051 microcontroller:
Let’s see the program for transmitting character ‘S’ using the serial window at baud rate of 9600:
Consider the 28800 is the maximum baud rate of the 8051 microcontroller For obtaining the 9600 as the baud rate, the timer value is,
This baud rate ‘3’ is stored inside a timer.
Let’s see the program for receiving the data from the HyperTerminal and sending of that data to PORT 0 of the microcontroller at 9600 baud rate:
Consider the 28800 is the maximum baud rate of the 8051 microcontroller For obtaining the 9600 as the baud rate, the timer value is,
This baud rate ‘3’ is stored inside a timer.