i am using switch function below
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.
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.0)&&(Mode_flag == 1))
{
low = 0.0;
}
else if(( low>20)&&(low<40)&& (Mode_flag == 0))
{
// do required
}
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.0)&&(Mode_flag == 1))
{
high = 0.0;
}
else if((high>20)&&(high<40)&&(Mode_flag == 0))
{
// do required things here
}
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);
}
}
}
that doubt was cleared kulakarni but i want to stor those values in flash memory
if(flag == 1)
{
if(condition)
}
else
{
}
like that i did
but finally i want to stor those values in flash memory we can take 4 bytes
intially two bytes i did .but problem with flag
if i press 1 store 0 to 20 range values in flash memory
if i press other one 20 to 40 range values store in flash memory give me idea?
if(incr == 0)
{
MSDelay(5);
if(incr == 0)
{
if(Mode_flag == 0)
Mode_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();
see this above code in that code previously i store ranges of common for both
now i want to store 4 bytes ...
l_flash low range
h-flash high range
but i want to more for diffrent ranges
low = l[2]+l[1]+l[0];
low = p[2]+p[1]+p[0];
high = h[2]+h[1]+h[0];
high = q[2]+q[1]+q[0];
like this i am giving so i want to store low values and high values in 2 types so for mem_read operation i want either or operation..
How can i give either l[x] or p[x]
give me idea pls..
I was not that much of proficient in this
if(incr == 0)
{
MSDelay(5);
if(incr == 0)
{
if(Mode_flag == 0)
Mode_flag = 1;
else
{
if(SW_flag == 0)
{
low++;
If(Mode_flag == 1)
{
if(low > 20.9)
low = 0.0;
}
else
{
if(low > 40.0 || low < 20.0)
low = 20.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();
In the above code i want to save if low > 20 ...in l_flash and similarly if low > 40 store in another flash.
similarly high also..
give me suggestion
very urgent..
low > 20.0
store in l_flash
low < 20
store in P-flash
similarly
high > 20.0
store in h_flash
high < 20.0
store in q_flash
like that i want ..pls modify in that code or give me idea...
i hope u understand what i am saying
i gave L-flash h_flash p_flash q_flash
how can i give flash for p_flash and q_flash..\
And if u dont mind tell me which book is best for embedded C
high ++;
if(Mode_flag == 1)
{
if(high > 20.9)
high = 0.0;
}
else
{
if(high > 40.0 || high < 20.0)
high = 20.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];
similarly hiw can i stor for p_flash and q_flash..
variable is same low and high \
but memory values stor different for 2 variables
l = l[2] + l[1] +l[0];
h = h[2] + h[1] +h[0];
l= p[2] +p[1]+p[0];
h = q[2] +q[1] + q[0];
i want either or operation or both ....for above code
Kulakarni If u dont mind please help me .i hope u understood this problem.
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.0)&&(Mode_flag == 1))
{
low = 0.0;
}
else if(( low>20)&&(low<40)&& (Mode_flag == 0))
{
// do required
}
convert_lcd(low*10, 3);
lcdcmd(0xC0);
lcddata(a_lcd[2]);
lcddata(a_lcd[1]);
lcddata('.');
lcddata(a_lcd[0]);
while(incr == 0);
}
}
}
if(Mode_flag == 1)
convert_flash(low*10, 3);
for(t = 0 ; t < 3 ; t++)
l_flash[t] = flash[t];
else
convert_flash(low*10, 3);
for(t = 0 ; t < 3 ; t++)
p_flash[t] = flash[t];
MEM_erase();
MEM_write();
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?