LCD16x2 is a popular display module and commonly used in various devices. In this tutorial, I will explain about LCD16x2 basic operation. LCD16x2 that I will use have a Hitachi HD44780 (or compatible) controller chip. In this tutorial, I will not use any microcontroller for controlling the LCD, but just use a series of switches, because it will be useful to understand the working principle of HD44780 controller chip. When you use microcontroller to drive LCD effectively, this experiment can be a benefical step to have more knowledge about HD44780 chip rather than just use existing library. You can get the datasheet for HD44780 chip from here.
The first step of this experiment is make the circuit. I will make this circuit on a breadboard. This is the circuit that I use for this experiment.
LCD16x2 has 16 pins:
- Pin 1 and 2 are Vss and Vdd pins for this LCD module. Vss pin should be connected to 0V supply or ground. Vdd pin should be connected to positive supply (usually +5V, but it also works with +3.3V).
- Pin 3 is Contrast (Vee) pin. This pin is usually connected to a variable resistor that create a voltage divider circuit. the more voltage input to this pin, the contrast is more low, otherwise the contrast is more high. If you don’t have a variable resistor you can also connect this pin to GND through a 10 KΩ resistor.
- Pin 4 is Register Select (RS) pin. If this pin is low, then the LCD will only accept command, otherwise if the pin is high, then the LCD will accept data.
- Pin 5 is Read/Write (R/W) pin. This pin has to be low in order to write command or character data to its register. To read character data from its register, this pin has to be high.
- Pin 6 is Enable (E) pin. This pin is used to initiate the actual transfer of commands or character data between module and data lines. When writing to the module, data is transferred only when falling edge of this signal. When reading from the module, data will available after rising edge of this signal and remain available until this signal falls to low again.
- Pin 7 to 14 are data bus lines (D0 to D7). Data can be transferred either as single byte (8-bit) or two nibbles (4-bit). When using 4-bit mode only D4 to D7 are used. 4-bit mode is useful when using microcontroller, because it is use fewer GPIO pins.
- Pin 15 and 16 is Vcc and GND pin for LCD backlight. You can connect this pins to power and ground through a 330 Ω resistor.
This is how I made this circuit on my breadboard.
Go to the part 2 of the tutorial.