Programmable LCD counter


An HD44780 character LCD is industry standard liquid crystal display designed for interfacing with embedded systems. These LCDs come in various sizes including 8×1, which has one row of eight characters, 16×2, and 20×4. In some cases, it is required to use bigger LCDs for that reason, there is 40×4 LCD which requires two HD44780 controllers with expansion chips since HD44780 can address only 80 characters.

7lcd2

Fig.(1): Character LCD

Unfortunately, the character LCDs are limited only for text for that reason it is often used in fax machines, printers, and other industrial equipments. The character LCDs come with either 14-pin interface or 16-pin interface when it has a back light. The pin out of the LCDs  are:

1- Ground

2- VCC (+3.3 to +5V)

3- Contrast adjustment (VO)

4- Register Select (RS). RS=0: Command, RS=1: Data

5- Read/Write (R/W). R/W=0: Write, R/W=1: Read

6- Clock (Enable). Falling edge triggered

7- Bit 0 (Not used in 4-bit operation)

8- Bit 1 (Not used in 4-bit operation)

9- Bit 2 (Not used in 4-bit operation)

10 – Bit 3 (Not used in 4-bit operation)

11- Bit 4

12- Bit 5

13- Bit 6

14- Bit 7

15- Backlight Anode (+)

16- Backlight Cathode (-)

   There may also be a single backlight pin, with the other connection via Ground or VCC pin. The two backlight pins may precede the pin 1.The nominal backlight voltage is around 4.2V at 25?C using a VDD 5V capable model. Character LCDs can operate in 4-bit or 8-bit mode. In 4 bit mode, pins 7 through 10 are unused and  the entire byte is sent to the screen using pins 11 through 14 by sending 4-bits (nibble) at a time.

   In this tutorial, a programmable LCD counter is designed and implemented to count numbers from 0 to 9 using PIC16F877A. The main goal of this project is to give an idea about how to use a character LCD to counts numbers. These numbers could be the speed of a motor, the temperature of oven, etc.

 As mentioned in the introduction, the character LCD can work in two operation modes, 4-bit and 8-bit. In this tutorial, I preferred to use the 4-bit operation mode to control in the LCD, also this mode is cheaper since less wires are needed and less pins are used from the Micro-controller to drive the LCD. This give us the opportunity to use the other pins to do another functions.

7lcd3

Fig.(2): Circuit Diagram

C_asm_SourceCode