AVR Development Board – AVR-DK20A User Manual
38
A.9 Experiment 5 – Display “Hello World!” to LCD Display
//Experiment 5
//Title : LCD Display
//Jumper for LCD : LK2-LK8
//Jumper Setting: A1-E,A2-RS,A3-RW,A4-LD4,A5-LD5,A6-LD6,A7-LD7
// LCD module connections
sbit LCD_RS at PORTA2_bit;
sbit LCD_EN at PORTA1_bit;
sbit LCD_D4 at PORTA4_bit;
sbit LCD_D5 at PORTA5_bit;
sbit LCD_D6 at PORTA6_bit;
sbit LCD_D7 at PORTA7_bit;
sbit LCD_RS_Direction at DDA2_bit;
sbit LCD_EN_Direction at DDA1_bit;
sbit LCD_D4_Direction at DDA4_bit;
sbit LCD_D5_Direction at DDA5_bit;
sbit LCD_D6_Direction at DDA6_bit;
sbit LCD_D7_Direction at DDA7_bit;
// End LCD module connections
char txt1[] = "Hello World!";
void main(){
DDRA = 0xff;
PORTA3_bit = 0;
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
do{
Lcd_Out(1,1,txt1); // Write text in first row
} while(1);
}