In this article, we are publishing a project which explains different aspects of interfacing a Graphical LCD (GLCD ) with 8051 microcontroller. Nokia 5110 is aÂ 48 x 84 graphic LCD that has an internal controller PCD8544 to control all displays and operations. The Nokia 5110 is interfaced to the microcontroller through a serial bus interface. After going through the project you can display the graphics or text you wish to be displayed. So lets begin our tutorial and learn how to interface a graphical LCD like Nokia 5110 Display to the 8051 micro controller.
So letâ€™s come to our project!
Objectives of the Project
- Understanding the basics of Nokia 5110 GLCD.
- Serial Bus interfacing of GLCD with 8051.
- Generating code for displaying the graphics or text you need to display.
Let’s begin to build our project!
Assemble the circuit as shown in the diagram! Component and connections are explained below
- 48 x 84 Graphic LCD Display
- Serial Bus Interface
- Internal Controller – PCD8544
- LED Back-Light
- Supply Voltage 2.7 -5.0 Volt
- Low power consumption
- GND => Â Ground Pin | Connect to Â 8051 GND
- BL => Â Â Pin to controlÂ LED (Back Light) | Connect to 3.3V
- VCC =>Â Â Power Supply Pin fromÂ 7 â€“ 5 V | Connect to 3.3V
- CLK => Â Â Pin Clock (Serial Clock Line for SPI communication) |Â Connect to P2^1 of 8051.
- DIN => Â Â Pin Data (Serial Data Line for SPI communication) | Connect to P2^2 of 8051.
- DC Â =>Â Â Pin to select Command or Data mode for data formats | Connect to P2^3 of 8051.
- CE Â Â => Â Â Chip enable input. The enable pin allows data to be clocked in. The signal is active LOW. | Connect to P2^4 of 8051.
- RST =>Â Â External reset. This signal will reset the device and must be applied to properly initialize the chip. The signal is active LOW. |Â Connect to P2^5 of 8051.
The program is written in embedded C language. The important aspects and subroutines of the program are explained below.
At the beginning of the program, a header file named â€œreg52.hâ€ is included. It is a header file for generic 80C52 and 80C32 microcontroller. You can replace it with the header file of your controller which comes under 8051 family. After that, you can see two large arrays named â€œCircuitsTodayLogoâ€ and â€œLookUpTableâ€.Â First one is for displaying circuitstoday logoÂ (as you can see in the header area of this website).Â Â And the latter is for writing normal text. You can replace the first one with the array of your own logo. Array for your logo can be generated by simply uploading the logo image in the following link. https://www.riyas.org/2017/01/online-tool-to-convert-bitmap-to-hex-nokia-arduino.html
As mentioned earlier the signal connection for controlling operation of LCD is the Serial format. Command mode and Data mode are the two modes that are used for communicating with LCD.
The DC pin of the LCD is used for selecting the mode. if DC = 0, the data that is sent to the LCD is Command and if DC = 1, the data that is sent to LCD will be Data and it will be placed in DDRAM Memory (Display Data RAM) to be displayed on LCD Display. The value of DDRAM will be incremented automatically after writing 1 byte into it. While sending each byte, the MSB will be sent first. A subroutine namedÂ â€œSend()â€ is using here for sending bytes to the LCD. Data will be shifted to Din pin during every rising edge of the signal clock.
â€œData()â€ and â€œCmd()â€ are the subroutines used for selecting the mode of sending data (Data mode and Command mode). The arrangement of memory in LCD 5110 is in matrix form consist of 6 rows (Y Address) and 84 columns (X Address). Data will be sent as bytes and it will be arranged as a vertical line. If we want to access to the position of displaying the result on LCD Display, we must refer to the relationship between X-Address and Y-Address. Subroutines used for this are â€œsetPixel()â€ and â€œsetCursor()â€. â€œallClear()â€ is the subroutine used for clearing the entire DDRAM.
As the name says â€œInitialize_LCD()â€ is the function used for sending commands to the LCD for its initialization. â€œcharDisp()â€ and â€œstringDisp()â€ are for displaying characters and strings respectively.
The output is shown in photograph!