Intro to LCD Display Programming | Character LCDs
Character LCD Display Programming
Before you get involved with LCD display programming, its critical you first choose the correct LCD display for your product. All LCD modules can be classified into one of two categories: those requiring a controller/driver chip and those that don’t.
Displays requiring a controller/driver chip to interface with your product require a programmer to write software code, sometimes referred to as firmware, to connect the LCD to the end product. Those that have a controller/driver are much easier and faster to program. Specifically, this article will address programming the character or alphanumeric displays with a parallel bus (a parallel bus LCD sends and receives 4 bits, 8 bits or 16 bits of data at a time).
The second category, those that don’t require a controller/driver chip, are called static or segment displays. This means that there is one connection on the LCD for each segment. Although this eliminates the controller chip, it requires a great deal of connections between the display and the customers product.
LCD displays with a controller/driver:
- Character or alphanumeric displays
- Graphic or dot matrix displays
- TFT (Thin Film Transistor Technology)
- OLED (Organic Light-Emitting Diode)
- FSC (Field Sequential Color LCD)
- UWVD (Ultra-Wide Viewing Display Technology)
LCD displays without a controller/driver:
- Static displays
- Multiplexed displays
LCD Display Programming Requires a Controller/Driver
So what exactly is this all important piece of technology—the controller/driver (C/D)—that will make your life easier through quick and simple programming? It is a small microprocessor whose function is to convert the designers’ firmware/software into characters, numbers, and punctuation marks. The C/D makes it easy for the product designer to quickly program the character display. Inside each C/D is a character table, sometimes referred to as a character map or font table, which contains pre-loaded letters, numbers, and punctuation. The table allows the designer to call out the requested character by addressing the number of that character. In other words, the letter ‘T’ may be the number 27 and the n-dash (i.e. “-”) could be number 122. This eliminates the need to create each character from scratch and reduces the amount of time necessary to program the LCD module. In the font table shown below, the letter ‘P’ would be displayed when the designer calls the number sequence below.
D0=0, D1=0, D2=0, D3=0, D4 =0, D5=0, D6=1, D7=1. The letter Do, D1 and so on above means data bit 0, data bit 1 etc. Most character displays use eight data bits.
The character table contains 255 possible characters. This number of characters is sufficient for one language, but would be impossible to display every character in every language when limited to only 255 options. This challenge is solved by making use of a different C/D for each language. You can order a C/D for French, German and many other languages.
There are several manufactures of C/D’s including Seiko, Epson, Toshiba, and Sunplus. There are distinct advantages of having multiple makers in multiple places in the world. Specifically, you won’t have to worry about a delay in the supply chain that is the result from the constraint of the C/D being made by only one or two manufacturers. You don’t want anything to delay the launch of your product.
The Standard Pin Out When Programming Character LCD displays
Character LCD displays contain 14 pins if no backlight is attached and 16 pins when an EL or LED backlight is included with the module. Below is a breakdown of each pin and the function of that pin. The function of these pins directly relates to your success at programming character LCD displays, so pay attention!
GND
The Ground is necessary for the voltage and the contrast adjust to reference. Ground, also referred to as zero volts, is required on all electronic devices. Electrical ground is similar to the ground floor of a tall building. All the floors above the ground floor are positive and all the floors below the ground floor, the basement, are negative. The ground pin on the LCD is connected to the ground on the customer’s product
VDD
This is the Logic voltage necessary to drive the LCD. There are two common voltages for a character LCD, 3.3V (this is equal to two ‘aa’ batteries in series) and 5V.
It is possible to order a character LCD with both a positive and negative voltage. This option is not very common and is seen in replacing older discontinued displays.
We do not recommend using the same Ground and VDD connections to supply both your LCD logic and your LED backlight. It is better to use a separate power for your backlight which is what pins 15 and 16 or the A and K tab on the side of the LCD are designed for.
V0
This is the connection for the contrast adjust. This function is to modify the voltage between VDD and Ground and then to adjust the contrast. If you are not able to achieve the desired contrast, it may be necessary to add a resistor to the back of the printed circuit board. The addition of the resistor alleviates the low contrast issue.
RS
Register Select has two positions: 1 (on or high) or 0 (off or low). When RS is low (0), the data is to be treated as an instruction such as ‘move the position of the cursor’ or ‘clear the screen’. When RS is high (1), the data being sent to the display is a letter, number or punctuation mark that is to be displayed on the screen.
RW
The RW line is the “Read/Write” control line. When RW is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Only one instruction ‘check LCD status’ is a read command. All others are write commands–so RW will almost always be set to low.
EN
The Enable line is used to tell the LCD module that you will be sending it data. To send data to the LCD this line must be set to low (0).
DATA BITS
The data bits on a parallel LCD display can accept up to 8 bits of data at a time. It is possible to use just four of the eight data bits if your microcontroller lacks enough connections to drive all 8 bits; however, this is a slow transfer of information. The data bit lines are numbered DB and begin at number DB0, DB1 etc. up to DB7.
A and K
These two lines are called A for Anode and K for Cathode. Yes, it is strange to use the letter K for a word that starts with a C, but that is an entirely different subject!
The anode is the positive voltage for the backlight, while the K is the ground for the backlight. You have options when it comes to ordering your backlights; you can order an LCD display with either a 3.3V LED backlight or a 4.2V LED backlight.
Final Notes on Programming LCD displays
One key component in LCD display programming is to make sure the controller driver you have designed will continue in production. Over time C/D suppliers will discontinue various models. So, the issue you solved with maintaining a steady supply chain does crop up again when models become obsolete. To mitigate the inconvenience, when the IC is discontinued, the LCD supplier will recommend a replacement or compatible controller. This is where the word ‘compatible’ does not mean ‘exact drop in equivalent’; however, we find that a compatible controller is an exact match 95% of the time. If you find yourself in that unlucky 5%, then you will either need to make a last-time buy of the controller that is being discontinued or change the software on your product to match the new controller.