Sunday, February 27, 2011

Display string in LCD with input from push buttons

/* to display the given char in LCD when pressing buttons*/
//LCD in 4-bit mode

#include <at89x51.H>
#include <lcd.h>

void initialization();
void main ()

{
LCD_init();
initialization();

while(1)
{
while (P0_0 ==1) //push button1
{
LCD_row1(); LCD_puts("Welcome");
}

while (P0_1 ==1)//push button2
{
LCD_row2(); LCD_puts("to 8051 world");
}
}
}

void initialization()
{
P0 = 0x00;
}

No comments:

Post a Comment