16×2 LCD display connection details with ATMega8 microcontroller

You can use 16×2 LCD display in your microcontroller kit by using these connections. Once the hardware connections are done properly, as shown below, don’t forget to include the “lcd.h” and “lcd.c” files in your source code, as follows:

The code for displaying the characters on the LCD display is also given below.

...
include "lcd.h" // file to drive the LCD display properly
include "lcd.c" // the C file for the LCD display
...
...
...
void main()
{
//Initialize the LCD Module
LCDInit(LS_NONE);
	
LCDClear();
LCDWriteString("16 character message");
LCDWriteStringXY(0,1,"16 character message");
_delay_ms(2500);
LCDClear();
...
...
...
while(1)
{
LCDWriteIntXY(0,0,variable_value_to_display,4);
LCDWriteString(" unit_if_any");
_delay_ms(500);
....
....
....
}
}
Detailed connection diagram of 16×2 LCD display with ATMega8

You can download these two files from following links: