Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Serial data received from pc and displayed on 16×2 lcd using 8051(89c51,89c52) microcontroller UART port

By EG Projects February 11, 2021

In this post i am going to explain how to receive serial data from your pc and display it on 16×2 lcd using 89c51 microcontroller UART port. Hardware components of the project includes max232(TTL to RS232 level converter/shifter ), 8051(89c51,89c52) microcontroller and 16×2 lcd. On software side i am using Hyper terminal. Hyper terminal is a program through which one can transmit and receive data serially using personal computer(PC) serial ports. Standard  PC has two serial ports, db-9 and db-25. To these serial ports we usually connect our printers, fax machines, mouse and joy sticks.
The block diagram of data transfer between 89c51 microcontroller UART port and personal computer is shown below. 

8051 microcontroller serial data transfer between pc and 89c51 uart port

8051 microcontroller serial data transfer between pc and 89c51 uart port

Max232 Level converter

8051 microcontroller works on TTL logic and personal computers works on rs232 logic. In order to communicate between the two modules data must be on the same carrier logic. Hence a level shiftier like max232 is used. Which transforms data from one logic to another before sending it to the receiver. In order to learn more about max232 transceiver, its pin out, working and power requirements please take the below tutorial. 

Max232 Pin out and Working

8051(89c51,89c52) Microcontroller UART

89c51 microcontroller Uart is used to receive data from PC. You can also use any other 8051 series microcontroller like 89c52 microcontroller. But first be sure it has build in UART(universal asynchronous receiver transmitter)for serial communication.

Port-1 of our microcontroller is used as output Port. It is connected to data pins of 16×2 lcd. 

  • Port-3 pin# 5 is connected to rs(regester select) pin of 16×2 lcd. 
  • Port-3 pin# 6 is connected to en(enable) pin of 16×2 lcd. 
  • Port-3 pin# 7 is connected to rw(read write) pin of 16×2 lcd.

If you dont know how to interface lcd with 8051(89c51,89c52) microcontroller here are some good tutorial, just go through them.

  • 16×2 LCD WORKING.
  • DIFFERENCE BETWEEN COMMANDS AND DATA SEND TO LCD.
  • DISPLAYING YOUR NAME ON LCD using 8051 MICROCONTROLLER.

serial data receiverd from pc hyperterminal and displayed on lcd using 8051(89c51,89c52) microcontroller

serial data receiverd from pc hyperterminal and displayed on lcd using 8051(89c51,89c52) microcontroller

Project Code

In the main function i first called the lcdinit() function to initialize the 16×2 lcd. All the commands used in the function  are deeply discussed in the above tutorials. Then timer mode is set. TMOD=0x02 means Timer1,  Mode2 (8 bit auto reload) is selected. TH1=0xFD is actually timer one high byte, giving 0xFD hexadecimal value to TH1 means setting communication baud rate between 8051 microcontroller and PC to 9600 bps(bits per second). SCON=0x50 is actually setting our serial data bits format Total=8 Data bit with 1 start bit and 1 stop bit. TR1=1 means run timer one. This whole phenomena with full meaning of the statements (SCON,TMOD,TH) is discussed in the below two tutorials. How to calculate baud rate values are also discussed.

  • HOW TO SEND SERIAL DATA TO PC(Hyperterminal).
  • TIMER REGISTERS OF 8051(89c51).

while(RI==0) is checking RI(receive interrupt) flag continuously. This flag automatically becomes one when 8051(89c51,89c52) receives any data on its RXD pin(P3^0). when RI becomes 1 it means we have one byte of data in our SBUF(serial buffer) register. So in next statement i picked the Byte from SBUF register and save it in character variable data. Then i made the RI flag low again to receive next byte. The Byte which i saved in data variable is now send to display function to be displayed on the 16×2 lcd. 

Download the project files and Code(Hex,c++) compiled using keil uvision 4 compiler. If you feel any problem in the code or don’t understand any statement of the code just write your queries below. The code is Tested using Hardware and its free of any bug. << />iv>
Serial data Received from PC 

You may also like:

  • battery types
    What are the different battery types for specific applications?

  • What are EMS/EMC immunity lab tests?

  • What are the top development boards for AI and ML?

  • What are the different types of electric vehicles?

  • How do dc-dc converters work?

  • What are the top open-source software systems for home automation?

Filed Under: 8051 Microcontroller, Electronic Projects, Featured Contributions, Microcontroller Projects

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • High Side current sensing
  • How to simulate power electronics converter in PSpice?
  • Voltage mode pushpull is a nonsense SMPS?
  • Layout IRN reduction in Comparator

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe