Pin No.Name Description
1 VSS Power supply (GND)
2 VCC Power supply (+5V)
3 VEE Powersupply to control Contrast
4 RS 0 = Instruction input/ 1 = Data input
5 R/W 0 = Write to LCD module / 1 = Read from LCD module
6 EN Enable signal
7 D0 Data bus line 0 (LSB)
8 D1 Data bus line 1
9 D2 Data bus line 2
10 D3 Data bus line 3
11 D4 Data bus line 4
12 D5 Data bus line 5
13 D6 Data bus line 6
14 D7 Data bus line 7 (MSB)
Code (Hex) Command to LCD Instruction (Register)
1 Clear display
2 Return home
4 Decrementcursor (shift cursor to left)
6 Incrementcursor (shift cursor to right)
5 Shift display right
7 Shift display left
8 Display off, cursor off
A Display off,cursor on
C Display on,cursor off
E Display on, cursor blinking
F Display on,cursor blinking
10 Shift cursor position to left
14 Shift cursor position to right
18 Shift the entire display to the left
1C Shift the entire display to the right
80 Force cursor to beginningof first line
C0 Force cursor to beginning of second line
28
38
•Towrite“Hello”ontheLCDusing8-bitdata.
LCD Connections for 8-bit Data
void lcd_write(unsigned char data)
{
lcd_data= data;
ctrl = (1<<rs)|(0<<rw)|(1<<en);
_delay_ms(1);
ctrl = (1<<rs)|(0<<rw)|(0<<en);
_delay_ms(50);
return ;
}
void lcd_write_string(unsigned char *str) //store address value of the string in pointer
*str
{
int i=0;
while(str[i]!='\0‘) // loop will go on till the NULL character in the string
{
lcd_write(str[i]); // sending data on LCD byte by byte
i++;
}
return;
}