How to create custom characters on 16x2 LCD using 8051 microcontroller (AT89C51)
The commonly used 16x2 LCD can also display custom made characters besides numbers, alphabets & special characters. Any character can be made to appear on a 5x8 pixel matrix element without knowledge of its ASCII value. The idea explained here demonstrates the principle and operation of a simple LCD custom character display using 8051 microcontroller (AT89C51).
When the ASCII code for any character, say ‘A’, is sent to be displayed on LCD module, the module's controller looks up the appropriate 5x8-pixel pattern in ROM (read-only memory) and displays that pattern on the LCD. There are 8 symbol locations where a custom character can be stored as shown in the following right table. These locations will have a particular bitmap layout corresponding to the custom character. To display an arrow sign, the bitmap values are mapped to a base address location, say 64 (ASCII code 0).
The symbol locations with their base addresses are given below:
- Set RS (Register Select) and R/W (Read/Write) pins of the LCD to initialize the LCD to accept instructions
- Set the CG RAM address by sending an instruction byte from 64 to 127 (locations 0-63 in CG RAM).
- Switch to Data Mode by changing the setting of RS pin
- Send bytes with the bit patterns for your symbol(s). The LCD controller automatically increments CG RAM addresses, in the same way as it increments cursor positions on the display.
- To leave CG RAM, switch to Command Mode to set address counter to a valid display address (e.g. 128, 1st character of 1st line); the clear-screen instruction (byte 1); or the home instruction (byte 2). Now bytes are once again being written to the visible portion of the display.
- To display the defined custom character print ASCII codes 0 through 7.
This Code is only visible to Registered users. Please Login/Register
A preset is a three legged electronic component which can be made to offer varying resistance in a circuit. The resistance is varied by adjusting the rotary control over it. The adjustment can be done by using a small screw driver or...
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments...
Browse 4m+ Electronic Products