This is a simple project on how to display/print your name on 16×2 lcd using 8051(89c51) microcontroller. Character lcd’s comes in many packages 16×2 , 8×1 ,16×1 ,8×2. All the lcd’s performs actually the same function, display data that we send to them. Displaying data on 16×2 lcd is not an easy task, its also not that much hard. You should first be familiarize with the 16×2 lcd pin out and working, its internal structure, registers and lcd controller.
I recommend you to take this tutorial. It contains all the information about 16×2 lcd. Its pin out and the functions that are associated with each pin. Lcd’s most important pins rs(register select) rw(read write) and en(enable) are also discussed. Commands used to initialized the lcd and many other’s are given in it. Generation of character on a 5×8 matrix is also highlighted.
I recommend you to take this tutorial. It contains all the information about 16×2 lcd. Its pin out and the functions that are associated with each pin. Lcd’s most important pins rs(register select) rw(read write) and en(enable) are also discussed. Commands used to initialized the lcd and many other’s are given in it. Generation of character on a 5×8 matrix is also highlighted.
Display your name on lcd – Project circuit diagram
- Connect port 2 of 8051 microcontroller with 8 data pins of 16×2 lcd. Connect DB0 pin of 16×2 lcd to pin-0 of port 2 then DB1 to pin-1 and so on.
- Connect rs(register select) pin of 16×2 lcd to port 3 pin 5.
- Connect rw(read write) pin of 16×2 lcd with port 3 pin 6.
- Connect en(enable) pin of lcd to pin 7 of port 3.
- Apply 5 volts to pin 40(vcc) and 31(EA) of 8051(89c51) microcontroller.
- Use pin 9 of microcontroller as reset pin. Attach button to it when ever you want to reset your program press the button.
- Ground pin 20.
- Use crystal of 11.0592 MHz with two 33 pF capacitors in parallel to pins 18 and 19 of 8051 microcontroller.
Circuit diagram of the project is given below.
Displaying name on lcd – Project code
The code of the project is very easy to understand. I am using keil uvision 4 ide for writing and compiling code and generating hex file for 8051 microcontroller. First i included the header file reg51.h in code. This header file is necessary, if you are using keil software for your 8051 microcontroller code and generation of hex file. The header file contains necessary configurations of 8051 microcontroller. Then three individual bits of port 3 are declared. These bits are declared to be used with 16×2 lcd to toggle its rs, rw and en pins when needed. Then a simple delay loop is created for giving necessary delays where needed in our program code. Then a command function is created, it is performing the function of selecting command register of 16×2 lcd and carry out the task associated with each command. Then lcddata() function is selecting data register of 16×2 lcd and prints data on lcd that we input to it. lcd() function in main is initialing lcd in 16×2 mode with cursor blinking and display on. Rest of all the things in main function are characters that we want to print on our lcd.
Displaying name on lcd – Project Output
The output on the 16×2 lcd is “!!!WE LOVE!!!” on first line of lcd and “PAKISTAN” on second line of lcd. You can also change the code according to your need. If you want to print your name just place your name in lcddata() function instead of “!!!WE LOVE !!! PAKISTAN“.
Related Projects
Download the project code written in keil u visison 4 ide and please give us your feed back on the project.
Filed Under: 8051 Microcontroller, Electronic Projects, Microcontroller Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.