Hai,
Here i post a program for 4*3 keypad with LCD display make necessary changes.
unsigned short kp, cnt, oldstate = 0;
char txt[5];
void main()
{
cnt = 0;
trisc=0x00;
trisb=0xf0;
Lcd8_Config(&portc,&portd,1,3,2,7,6,5,4,3,2,1,0);
Lcd8_Cmd(LCD_CLEAR); // Clear display
Lcd8_Cmd(LCD_CURSOR_OFF); // Cursor off
Lcd8_Out(1,1,"start");
while(1)
{
portb=0x01;
while(portb.f4==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"1");
}
while(portb.f5==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"5");
}
while(portb.f6==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"9");
}
while(portb.f7==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"menue");
}
portb=0x02;
while(portb.f4==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"2");
}
while(portb.f5==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"6");
}
while(portb.f6==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"0");
}
while(portb.f7==1)
{
// Lcd8_Cmd(lcd_clear);
Lcd8_Out_CP("rst");
}
portb=0x04;
while(portb.f4==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"3");
}
while(portb.f5==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"7");
}
while(portb.f6==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"A");
}
while(portb.f7==1)
{
// Lcd8_Cmd(lcd_clear);
Lcd8_Out_CP("B");
}
/* wirte rest code*/
}
}