Serial Communication With 8051
by embeddedbymedhavi in Circuits > Microcontrollers
64 Views, 0 Favorites, 0 Comments
Serial Communication With 8051

SERIAL COMMUNICATION:
Serial Communication uses single data line making it much cheaperEnables two computers in different cities to communicate over the telephonebyte of data must be converted to serial bits using a parallel-in-serial-out shift register and transmitted over a single data lineReceiving end there must be a serial-in-parallel-out shift registerif transferred on the telephone line, it must be converted to audio tones by modemfor short distance the signal can be transferred using wirehow PC keyboards transfer data to the motherboard2 methods, asynchronous and synchronousSynchronous method transfers a block of data (characters) at a timeAsynchronous method transfers a single byte at a timeUses special IC chips called UART (universal asynchronous receiver-transmitter) and USART (universal synchronous asynchronous receiver-transmitter)
Half- and Full-duplex Transmission

- if the data can be transmitted and received, it is a duplex transmission
- simplex transmissions the computer only sends data
- duplex transmissions can be half or full duplex
- depends on whether or not the data transfer can be simultaneous
- If one way at a time, it is half duplex
- If can go both ways at the same time, it is full duplex full duplex requires two wire conductors for the data lines (in addition to the signal ground)
Asynchronous Serial Communication and Data Framing
- data coming in 0s and 1s
- to make sense of the data sender and receiver agree on a set of rules
Protocol :
- ·how the data is packed ·how many bits/character ·
- when the data begins and ends
Start and Stop Bits

Start and stop bits
- asynchronous method, each character is placed between start and stop bits · called framing · start bit is always one bitstop bit can be one or two bits
- start bit is always a 0 (low)stop bit(s) is 1 (high) ·LSB is sent out first
- in modern PCs one stop bit is standard
- when transferring a text file of ASCII characters using 1 stop bit there is total of 10 bits for each character
- 8 bits for the ASCII code (1 parity bit), 1 bit each for the start and stop bits · for each 8-bit character there are an extra 2 bits, which gives 20% overhead ·
- Data transfer rate:
- rate of data transfer bps (bits per second)widely used terminology for bps is baud rate
- baud and bps rates are not necessarily equal
- baud rate is defined as the number of signal changes per second
RS232 Standards


- most widely used serial I/O interfacing standard
- input and output voltage levels are not TTL compatible1 bit is represented by -3 to -25 V0 bit is +3 to +25 V ·-3 to +3 is undefined
- to connect RS232 to a microcontroller system must use voltage converters such as MAX232 to convert the TTL logic levels to the RS232 voltage levels, and vice versa
- MAX232 IC chips are commonly referred to as line drivers
Data Communication Classification

- DTE (data terminal equipment)
- DCE (data communication equipment)
- DTE - terminals and computers that send and receive data
- DCE - communication equipment responsible for transferring the datasimplest connection between a PC and microcontroller requires a minimum of three pins, TxD, RxD, and ground
Baud Rate

Write a Program to Transfer Letter "A" Serially at 4800 Baud, Continuously.

Simulation of transmit data from the PC is given in above.
C Code of Serial Transmit 'A':
Downloads
Write a Program to Transfer the Message "Hello" Serially at 9600 Baud, 8-bit Data, 1 Stop Bit. Do This Continuously.

Simulation of transmit data from the PC is given in above.
C Code of Serial Transmit "Hello" :
Downloads
Program the 8051 to Receive Bytes of Data Serially and Put Them on PORTB. Set the Baud Rate at 9600, 8-bit Data, and 1 Stop Bit.

Simulation of receive data from the PC is given in above.
C Code of Serial Receive:
Downloads
Any Query related Embedded System , IOT and Raspberry PI go to My Blog: