dear all,
the problem with the code is that when i press the switch at C0 it displays the count but wen i press switch at B0 it doesnt go out of the previous loop and still displays the count. i want that wen C0 is pressed it shud display the count and wen B0 is pressed it should clear the count and only display the text.
plz help me in this code
int i ;
char txt[5];
void main()
{
i = 0;
PORTB = 0;
TRISB = 0b00000001;
PORTC = 0;
TRISC = 0b00000001;
PORTD = 0;
LCD_Config(&PORTD,1,0,2,7,6,5,4); // LCD pins that are connected to PIC at PORTD
while(1)
{
if (!PORTC.F0 == 1)
{
i=i+1;
Lcd_Cmd(Lcd_CLEAR);
Lcd_Cmd(Lcd_CURSOR_OFF);
IntToStr(i, txt);
Lcd_Out(2,2 ,txt);
delay_ms(1000);
}
if(!PORTB.F0 == 1)
{
Lcd_Cmd(Lcd_CLEAR);
Lcd_Cmd(Lcd_CURSOR_OFF);
LCD_Out(1,1, "DINNAR BOX");
LCD_Out(2,1,"FOR HAJJ!");
}
}
} // for void
the problem with the code is that when i press the switch at C0 it displays the count but wen i press switch at B0 it doesnt go out of the previous loop and still displays the count. i want that wen C0 is pressed it shud display the count and wen B0 is pressed it should clear the count and only display the text.
plz help me in this code
int i ;
char txt[5];
void main()
{
i = 0;
PORTB = 0;
TRISB = 0b00000001;
PORTC = 0;
TRISC = 0b00000001;
PORTD = 0;
LCD_Config(&PORTD,1,0,2,7,6,5,4); // LCD pins that are connected to PIC at PORTD
while(1)
{
if (!PORTC.F0 == 1)
{
i=i+1;
Lcd_Cmd(Lcd_CLEAR);
Lcd_Cmd(Lcd_CURSOR_OFF);
IntToStr(i, txt);
Lcd_Out(2,2 ,txt);
delay_ms(1000);
}
if(!PORTB.F0 == 1)
{
Lcd_Cmd(Lcd_CLEAR);
Lcd_Cmd(Lcd_CURSOR_OFF);
LCD_Out(1,1, "DINNAR BOX");
LCD_Out(2,1,"FOR HAJJ!");
}
}
} // for void