WWW Mepits Com Tutorial 332 Avr 8051 How To Interface Comput
WWW Mepits Com Tutorial 332 Avr 8051 How To Interface Comput
Cart (0)
Home / Tutorials / AVR/ 8051 / How to interface computers Serial Port Tutorial by
(RS232) with Atmel AT89S51/89S52 Microcontroller? Mepits
computers Serial
Microcontroller? Atmel
AT89S51/89S52
Atmel AT89S51/52 microcontroller has an integrated UART module for carrying serial
Microcontroller?
communication. Serial communication makes use of asynchronous mode of
operation. Serial port is defined as an interface between the PC and a device for
Tags
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
transfer of data. AT89S51/52 with a serial port will allow reading and writing values to
UART
and from computer. Also note that the transfer of data through a serial port is bit by
bit. serial
communication
serial transmission
interfacing with
8051
microcontroller
8051
RS-232 8051
microcontroller
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Block diagram showing Interfacing of 8051
1. RS232
2. MAX232
3. AT89S51/52
RS232
DB-9 RS-232 is a serial I/O standard, used commonly in PCs and other devices.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
MAX232
The output of RS232 is not compatible with the TTL. Inorder to connect RS232 to
AT89S51/52 microcontroller, a converter is required. Here we make use of MAX232.
This can convert the output of the microcontroller to the RS232 output level and vice
versa. Usually, MAX232 consists of two line drivers for the transmission and reception
of data.
Atmel Microcontroller
AT89s51/52 uses SCON and SBUF registers for serial communication. SBUF is
basically a 8-bit serial communication register. For serial transmission of datas, the
data is first placed in SBUF . Also when a data is received serially, it comes in the SBUF
register.
Program
1. Serial Transmission
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Program to transmit the character 'B' serially
2. Serial Reception
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Program to receive the character 'B' serially
Program Description
Serial communication between the computer and the microcontroller follows the
below steps:
Step1
Inorder to configure the serial port, AT89S51/52 uses the SCON register. The SCON
register consists of the following registers as in the figure: In the program for serial
transmission and reception, SCON is entered with the value 0x40.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
5 SM2 Multiprocessor Communication Enable
1 TI Transmit Flag
0 RI Receive Flag
The bits SM0 and SM1 will determine the baud rate to be selected. Table below shows
how the baud rate is selected.
Step2
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Baud Rate
Baud rate is defined as the rate at which the data is transferred in bits per second.
Usually for serial communication the baud rate is set according to SM0 and SM1. If the
value of SM0 and SM1 are “00” or “10”, then baud rate depends upon the oscillator
frequency. In other cases, the baud rate depends upon the Timer 1 of the
microcontroller.
The value that has to be placed in TH1 to generate the required baud rate depends
upon the following equation.
In the program, TH1 is set to the value, 0xFD such that the baud rate is 9600bps
according to the above equation for a crystal frequency of 11.059MHz.
Step3
After step 1 and 2, the serial port can be used for transmission and reception of data.
Hyper terminal is used for the reception and transmission of data through RS232.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
In the program of serial transmission, the letter ‘B’ is transmitted through SBUF of the
controller and is displayed on the hyper terminal of PC. While, in case of serial
reception, data is entered on the hyper terminal and it is serially received through the
SBUF of microcontroller. Inorder to view the output on the microcontroller, in case of
serial reception, LCD interfacing has to be done.
Related Items
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
JFET - Electronic Component
Tutorial
Field E ect Transistor is a three terminal device electronic compo…
More details
Links
About Us Terms and Conditions Contact Us
Privacy Policy Feedback FAQ
Contact Us
Phone : +918129818284, +918129818325
Email : [email protected], [email protected] Copyright © 2021 Mepits - Designed By Digiora
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD