Interface lcd 24 × 2 com microcontrolador 8051 (89c51,89c52) e microchip pic16f877

24×2 LCD interface with 8051 microcontroller (89c51,89c52) and pic16f877 microchip

In this post I will explain how to interface the 24×2 LCD with the microcontroller. I will interface the LCD with the 8051 (89c51,89c52) and Microchip Pic16f877 microcontrollers. 24×2 means 24 Coulombs and 2 lines. Total characters we can display on 24×2 LCD (24×2 = 48) 48. 24 characters on each line. Interfacing the 24×2 LCD with the microcontroller is the same as we interface other character LCDs with microcontrollers. 24×2 LCDs are controlled by the hd44780 controller, the same controller used to control 8×1,16×2,20×2 LCDs. The commands to initialize 24x2 LCD are the same as those used to initialize other character LCDs. The LCD registers are also the same. The process of reading and writing data is also the same.

About LCD

The LCD I'm using is from Samsung. Their number is unknown. Only one number UC24202, GNAR4PA, 010429, is written on the back. “Made in China” is also mentioned 😀 I found this LCD in an old control system panel. The control panel is out of use, so I removed this LCD from the panel and used it in my DIY project. I couldn't find the LCD pin on the internet. I was able to locate the pin names by mapping the header with standard character lcds.
Samsung 24x2 LCD, UC24202

Samsung LCD 24×2, UC24202, GNAR4PA, 010429,

24×2 LCD interface with 8051 microcontroller(89c51,89c52)

Interfacing 24×2 LCD with 8051 (89c51,89c52) microcontroller is an easy task. If you have already interfaced any character LCD with 8051 microcontroller (89c51,89c52), you can easily interface it 24x2. But if you don't, below are some short tutorials on LCDs that will help you understand how to interact and display characters on character LCDs.

  • Character LCD pinout and working.
  • How to display text on the character LCD.

I will display 'ABC' alphabets on LCD. The first line of the LCD will display uppercase characters and the second line will display lowercase alphabets, up to 'X'. Displaying text on the LCD is not a difficult task. Tutorial How to Display Text on Character LCD is a very useful feature to accomplish this task. I recommend you to do the tutorial (Link provided above the paragraph).

24x2 LCD interface with 8051 microcontroller(89c51,89c52)

24×2 LCD interface with 8051 microcontroller(89c51,89c52)
The LCD data pins are connected to Port 1 of the 89c51 microcontroller. LCD control pins en (Enable) is connected to port 3 pin #7, rw (read/write) is connected to port 3 pin #6, and rs (register select) is connected to port #5 pin 3. The delay function is used to generate some arbitrary delay. In the main function, variables a and b are initially initialized with 'A' and 'a' and are incremented one by one to display entire 'AbC' alphabets on the LCD.

24×2 LCD interface with Microchip Pic16f877 microcontroller


The interface of the 24×2 LCD with the pic16f877 microcontroller is the same as the interface with the 8051 (89c51). The only difference is in the ports. 8051 has ports-1,2,3 and 4 while photo has ports-A, B, C, D and E. I am interfacing lcd in 8 bit mode with photo 16f877. Port B of Pic16f877 is connected to LCD data pins. LCD control pins en (enable) is connected to port D pin #7, Rs (register select) is connected to port D pin #6, Rw (read-write) is connected to port pin #5 D. The circuit diagram of the project is given below.
The code is also the same as 8051 (89c51). The difference is in the 89c51 libraries which are programmed using the keil Compiler whereas the pic libraries are programmed using the high-end c compiler. Both compilers need different libraries to compile the code. The main function code is also similar to the main function code of 89c51 microcontroller.
24x2 character LCD interface with Pic 16f877 microcontroller

24x2 character LCD interface with Pic 16f877 microcontroller
Download the project files. The folder contains the code for interfacing the 24×2 LCD with the 8051 microcontroller (89c51,89c52) and pic 16f877. The project simulation is also in the folder. The simulation is done in Proteaus 8.0. Please give us your feedback on the post.

Watch the project video here….

Post by Microcontroller Projects.
24×2 LCD with 8051(89c51) microcontroller and pic 16f877

Back to the blog

Leave a comment

Comments need to be approved before publication.