fbpx
Troubleshooting and repairing Switch Mode Power Supplies

16×2 LCD Pinout Diagram | Interfacing 16×2 LCD with Arduino

We come across LCD displays everywhere around us. Computers, calculators, television sets, mobile phones, digital watches use some kind of display to display the time. An LCD is an electronic display module which uses liquid crystal to produce a visible image. The 16×2 LCD display is a very basic module commonly used in DIYs and circuits. The 16×2 translates o a display 16 characters per line in 2 such lines. In this LCD each character is displayed in a 5×7 pixel matrix.

16X2 LCD pinout diagram

Supply voltage; 5V (4.7V – 5.3V)

 Vcc

Contrast adjustment; the best way is to use a variable resistor such as a potentiometer. The output of the potentiometer is connected to this pin. Rotate the potentiometer knob forward and backwards to adjust the LCD contrast.

 Vo / VEE

RS (Register select)

A 16X2 LCD has two registers, namely, command and data. The register select is used to switch from one register to other. RS=0 for command register, whereas RS=1 for data register.

Command Register: The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. Processing for commands happens in the command register.

Data Register:  The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD. When we send data to LCD it goes to the data register and is processed there. When RS=1, data register is selected.

Important command codes for LCD

Sr.No. Hex Code Command to LCD instruction Register
1 01 Clear display screen
2 02 Return home
3 04 Decrement cursor (shift cursor to left)
4 06 Increment cursor (shift cursor to right)
5 05 Shift display right
6 07 Shift display left
7 08 Display off, cursor off
8 0A Display off, cursor on
9 0C Display on, cursor off
10 0E Display on, cursor blinking
11 0F Display on, cursor blinking
12 10 Shift cursor position to left
13 14 Shift cursor position to right
14 18 Shift the entire display to the left
15 1C Shift the entire display to the right
16 80 Force cursor to beginning ( 1st line)
17 C0 Force cursor to beginning ( 2nd line)
18 38 2 lines and 5×7 matrix

Displaying Custom Characters on 16X2 LCD

Generating custom characters on LCD is not very hard. It requires the knowledge about custom generated random access memory (CG-RAM) of LCD and the LCD chip controller. Most LCDs contain Hitachi HD4478 controller. CG-RAM is the main component in making custom characters. It stores the custom characters once declared in the code. CG-RAM size is 64 byte providing the option of creating eight characters at a time. Each character is eight byte in size.

CG-RAM address starts from 0x40 (Hexadecimal) or 64 in decimal. We can generate custom characters at these addresses. Once we generate our characters at these addresses, now we can print them on the LCD at any time by just sending simple commands to the LCD. Character addresses and printing commands are below

In the table above you can see starting addresses for each character with their printing commands. The first character is generated at address 0x40 to 0x47 and is printed on LCD by just sending simple command 0 to the LCD. The second character is generated at address 0x48 to 0x55 and is printed by sending 1 to LCD.

This content was originally published here.

Troubleshooting and repairing Switch Mode Power Supplies
LCD Monitor Repair Secrets
Electronic Repair Information

Check Also

Electronics Projects: Configurable RS232 To TTL To I2C Adaptor

RS232 signals cover a much longer distance than standard TTL and I2C signals. Also, RS232 …

Leave a Reply

Your email address will not be published.