prasadsrkrec
Junior Member level 2
i am using switch function below
Code:
void sw_press(void)
{
SFRPAGE = CONFIG_PAGE;
if(incr == 0)
{
MSDelay(5);
if(incr == 0)
{
if(Mode_flag == 0)
Mode_flag = 1;
else if(Cal_flag == 0)
Cal_flag = 1;
else
{
if(SW_flag == 0)
{
low++;
if(low > 20.9)
low = 0.0;
convert_lcd(low*10, 3);
lcdcmd(0xC0);
lcddata(a_lcd[2]);
lcddata(a_lcd[1]);
lcddata('.');
lcddata(a_lcd[0]);
while(incr == 0);
}
else
{
high ++;
if(high > 20.9)
high = 0.0;
convert_lcd(high*10, 3);
lcdcmd(0x80);
lcddata(a_lcd[2]);
lcddata(a_lcd[1]);
lcddata('.');
lcddata(a_lcd[0]);
while(incr == 0);
}
}
convert_flash(low*10, 3);
for(t = 0 ; t < 3 ; t++)
l_flash[t] = flash[t];
convert_flash(high*10, 3);
for(t = 0 ; t < 3 ; t++)
h_flash[t] = flash[t];
MEM_erase();
MEM_write();
}
}
if(decr == 0)
{
MSDelay(5);
if(decr == 0)
{
if(Mode_flag == 0)
Mode_flag = ~Mode_flag;
else if(Cal_flag == 0)
Cal_flag = ~Cal_flag;
else
{
if(SW_flag == 0)
{
low+= 0.1;
if(low > 20.9)
low = 0.0;
convert_lcd(low*10, 3);
lcdcmd(0xC0);
lcddata(a_lcd[2]);
lcddata(a_lcd[1]);
lcddata('.');
lcddata(a_lcd[0]);
while(decr == 0);
}
else
{
high+= 0.1;
if(high > 20.9)
high = 0.0;
convert_lcd(high*10, 3);
lcdcmd(0x80);
lcddata(a_lcd[2]);
lcddata(a_lcd[1]);
lcddata('.');
lcddata(a_lcd[0]);
while(decr == 0);
}
}
convert_flash(low*10, 3);
for(t= 0 ; t < 3 ; t++)
l_flash[t] = flash[t];
convert_flash(high*10, 3);
for(t= 0 ; t < 3 ; t++)
h_flash[t] = flash[t];
MEM_erase();
MEM_write();
}
}
if(entr == 0)
{
MSDelay(5);
if(entr == 0)
{
SW_flag = ~SW_flag;
buzzer = 1;
MSDelay(100);
buzzer = 0;
while(entr == 0);
}
}
}
If i press mode flag becomes 1 then it display first condition
if i press mode flag not one then it display other condition ...so how can i give different ranges for two different modes..
I want to change range 0 -20 for both low and high if mode flag 1
i want to change range 20 -40 for both low and high if mode flag not equal to one
incr (switch 1) incremented by 1
decr (switch 2) incremented by 0.1
give me sugggestions.