thannara123
Advanced Member level 5
seems while loop condition is not entering
Code:
#define BUTTON_H_
#define LEFT_S PINC&(1<<2)
#define RIGHT_S PINC&(1<<3)
#define UP_S PINC&(1<<4)
#define DOWN_S PINC&(1<<5)
#define OK_S PINC&(1<<6)
/* Function Key Value For UP_Down Key */ void UP_Down_Keyvalue(struct menu s1,int a,int b)
{ int ch,lower,upper;
[COLOR=#ff0000]while(OK_S) //[/COLOR]
{
if(UP_S)
{
while(UP_S);
LCD_Clear();
LCD_DisplayString("came to 1");
DELAY_ms(1000);
}
else if(DOWN_S) // down
{
while(DOWN_S);
LCD_Clear();
LCD_DisplayString("came to 2");
DELAY_ms(1000);
}
} }
int Key_pressed(void)
{
while(1){
if (LEFT_S) { while(LEFT_S);return 1; }
if (RIGHT_S){ while(RIGHT_S);return 2; }
if (UP_S) { while(UP_S); return 3; }
if (DOWN_S) { while(DOWN_S);return 4 ; }
if (OK_S) { while(OK_S);return 5 ; }
else return 0;
}
}