To establish a good communication between human world and machine world, display units play an important role. And so they are an important part of embedded systems. Display units – big or small, work on the same basic principle. Besides complex display units like graphic displays and 3D dispays, one must know working with simple displays like 16×1 and 16×2 units. The 16×1 display unit will have 16 characters and are in one line. The 16×2 will have 32 characters in total 16in 1st line and another 16 in 2nd line. Here one must understand that in each character there are 5×10=50 pixels so to display one character all 50 pixels must work together. But we need not to worry about that because there is another controller (HD44780) in the display unit which does the job of controlling the pixels. (you can see it in LCD unit, it is the black eye at the back ).
Power supply (5v)
JHD_162ALCD (16×2 LCD)
Atmel studio 6.1
Progisp or flash magic
As shown in the LCD interfacing with ATmega16 circuit, you can see that PORTA of ATMEGA32 connected to data port LCD. Here one should remember to disable the JTAG communication in PORTC of ATMEGA by changing the fuse bytes, if one wants to use the PORTC as a normal communication port. In 16×2 LCD there are 16 pins over all, if there is a back light, if there is no back light there will be 14 pins. One can power or leave the back light pins. Now in the 14 pins there are 8 data pins (7-14 or D0-D7), 2 power supply pins (1&2 or VSS&VDD or gnd&+5v), 3rd pin for contrast control (VEE-controls how thick the characters should be shown), 3 control pins (RS&RW&E)
In the circuit, you can observe tht I have only took two control pins. This give the flexibility of better understanding. The contrast bit and READ/WRITE are not often used so they can be shorted to ground. This puts LCD in highest contrast and read mode. We just need to control ENABLE and RS pins to send characters and data accordingly.
The connections which are done for LCD are given below:
PIN1 or VSS – ground
PIN2 or VDD or VCC – +5v power
PIN3 or VEE – ground (gives maximum contrast best for a beginner)
PIN4 or RS (Register Selection) – PD6 of microcontroller
PIN5 or RW (Read/Write) – ground (puts LCD in read mode eases the communication for user)
PIN6 or E (Enable) – PD5 of microcontroller
PIN7 or D0 – PA0 of microcontroller
PIN8 or D1 – PA1
PIN9 or D2 – PA2
PIN10 or D3 – PA3
PIN11 or D4 – PA4
PIN12 or D5 – PA5
PIN13 or D6 – PA6
PIN14 or D7 – PA7
In the circuit you can see we have used 8bit communication (D0-D7) however this is not compulsory and we can use 4bit communication (D4-D7) but with 4 bit communication program becomes a bit complex for beginners so just we went with 8 bit communication.
So from mere observation from above table we are connecting 10 pins of LCD to controller in which 8 pins are data pins and 2 pins for control.
For more detail: Interfacing LCD with ATmega32 Microcontroller