Engineering Knowledge

Free software, projects, tutorials & more!
Home     Links     Site Map     Contact Us      

 You are here: Home > Projects > Microcontroller Interfacing 

 

 Microcontroller Interfacing ("LCD & PC")

By Engineering Knowledge administrator Rev1.0

Copyright©  Engineering Knowledge 2007. All rights reserved.

 

This tutorial will show you how to interface the 8051 family with PC and LCD, you will see how to send data from your computer to microcontroller and display it on the LCD. As we know, RS-232 ("COM port") is the best way to establish a communication between the microcontroller & the personal computer, therefore, we will use Microsoft® Windows® Hyper Terminal program to send the data out side your PC, MAX232 to convert computer COM port signals into compatible TTL signals, the 20 pins AT89C2051 microcontroller from Atmel® and DMC LCD from Optrex®.

When two devices communicate serially, the most important thing is the Baud Rate, which should be same in both devices. 8051 devices support many baud rates as well as PC; in this article, we will use 9600 for both, 8 bit data, 1 stop bit and 1 start bit. Since no handshaking is not supporting by 8051 family; this option should be disabled in Hyper Terminal program. Microcontroller UART can be controlled through SCON register, see ("SCON Register") table at the right.
 

 Adjusting Hyper Terminal Setting

Open Hyper Terminal > File > Setting then select the desired COM port number, then hit "Configure" select 9600 for Bits per second "Baud rate". Data bits=8, Parity=None, Stop bit=1 Flow control=None then hit apply>Ok

 

Serial port mode used to identify the serial data frame. We agreed before that we would use 8 bit data, 1 stop bit and 1 start bit. So, make SM0=0 and SM1=1. 

 

The big advantage of using LCD; is that LCD do not need to be refreshed continuously, unlike seven or multi segment display, therefore; controller just latch the data

 Tip:
Don’t forget to make RS=0 to be able to read D7!

and continue other tasks. In addition, LCD can display number, character and in some cases graphics! In LCD user can send control signals as shown in the table at the right or data to be displayed, user can specify the type of data by applying the appropriate signal on pin RS. If you need to send a control command make RS=0 otherwise make it 1.

 

When you give LCD any command, it will take some times to execute it; so, after you issuing any command you should monitor D7. If D7=0 the LCD is ready to receive new information, if D7=1 its busy executing previous command.

 

Schematic for connecting microcontroller with LCD & computer at the left side. 

   

 

 

 

 

 

 

 

 

 

 

 

Below are the Table ("LCD Command Codes") at the left provide the common code to control the LCD's, and at the right is a program that coded in Assembly language to receive a byte from PC and display it on LCD.

  

 

Light Control System               *Very Informative!

 

Power Supply Design              *Very Informative!

 

 

 

*Sponsored Link.

 

 Microcontroller Interfacing ("LCD & PC")

By Engineering Knowledge administrator Rev1.0

Copyright©  Engineering Knowledge 2007. All rights reserved.