int i;
char txt[5];
void main()
{
i = 0;
PORTB = 0;
TRISB.F0 = 1; //PORT B0 as input // RB0 as input switch
TRISB.F1 = 1; //PORT B1 as input switch 2
TRISB.F2 = 0; //PORT B2 as Output
TRISB.F3 = 0; //PORT B3 as Output
TRISB.F4 = 0; //PORT B4 as Output
TRISB.F5 = 0; //PORT B5 as Output
TRISB.F6 = 0; //PORT B6 as output
TRISB.F7 = 0; //PORT B7 as output
PORTD = 0;
LCD_Config(&PORTD,1,0,2,7,6,5,4); // LCD pins that are connected to PIC at PORTD
while(1)
{
LCD_Cmd(LCD_CLEAR);
LCD_Out(1,1, "DINNAR BOX"); // Print text to LCD, 1st row, 1st column
Delay_ms(1000);
LCD_Out(2,1,"FOR HAJJ!");
if(PORTB.F0 == 1) // ! coz its input low thats
{
i=i+1;
IntToStr(i, txt);
Lcd_Out(2,2 ,txt);
Delay_ms(1000);}
if(PORTB.F1 == 1)
{
LCD_Out(1,1, "DINNAR BOX"); // Print text to LCD, 1st row, 1st column
Delay_ms(1000);
LCD_Out(2,1,"FOR HAJJ!");}
} // for while
} // for void