21ic问答首页 - stc的bug吗?
stc的bug吗?
lsc5012022-03-14
如下的程序,工作大约10分钟,if就判断为真,就进入了,
eerom.save_data.Blowback_cycle=6;
Blowback_hour=0;
TCON_bit.TR0 = 0; //停止定时器计时,防止改变小时变量影响if比较
if(eerom.save_data.Blowback_cycle==Blowback_hour)
{
Blowback_hour = 0;
OLED_Clear();
OLED_ShowCHinese(0,0,30);
OLED_ShowCHinese(16,0,31);
/*
i = sprintf(string,"fixed time");
OLED_ShowString(32,0,string);
*/
i = sprintf(string,"hout:%d",(int)Blowback_hour);
OLED_ShowString(32,0,string);
i = sprintf(string,"fixed time:%d",(int)eerom.save_data.Blowback_cycle);
OLED_ShowString(0,2,string);
Blowback();
OLED_Clear();
}
if(zero_seting_hour>=eerom.save_data.zero_seting_cycle)
{
zero_seting_hour = 0;
OLED_Clear();
OLED_ShowCHinese(0,0,12);
OLED_ShowCHinese(16,0,35);
i = sprintf(string,"fixed time");
OLED_ShowString(32,0,string);
zero_setting();
OLED_Clear();
}
TCON_bit.TR0 = 1;
后来改成
PSW_bit.CY = 0;
if(PSW_bit.CY==0)
{
TCON_bit.TR0 = 0; //停止定时器计时,防止改变小时变量影响if比较
if(eerom.save_data.Blowback_cycle==Blowback_hour)
{
Blowback_hour = 0;
OLED_Clear();
OLED_ShowCHinese(0,0,30);
OLED_ShowCHinese(16,0,31);
/*
i = sprintf(string,"fixed time");
OLED_ShowString(32,0,string);
*/
i = sprintf(string,"hout:%d",(int)Blowback_hour);
OLED_ShowString(32,0,string);
i = sprintf(string,"fixed time:%d",(int)eerom.save_data.Blowback_cycle);
OLED_ShowString(0,2,string);
Blowback();
OLED_Clear();
}
if(zero_seting_hour>=eerom.save_data.zero_seting_cycle)
{
zero_seting_hour = 0;
OLED_Clear();
OLED_ShowCHinese(0,0,12);
OLED_ShowCHinese(16,0,35);
i = sprintf(string,"fixed time");
OLED_ShowString(32,0,string);
zero_setting();
OLED_Clear();
}
TCON_bit.TR0 = 1;
}
这样就解决了,
eerom.save_data.Blowback_cycle=6;
Blowback_hour=0;
TCON_bit.TR0 = 0; //停止定时器计时,防止改变小时变量影响if比较
if(eerom.save_data.Blowback_cycle==Blowback_hour)
{
Blowback_hour = 0;
OLED_Clear();
OLED_ShowCHinese(0,0,30);
OLED_ShowCHinese(16,0,31);
/*
i = sprintf(string,"fixed time");
OLED_ShowString(32,0,string);
*/
i = sprintf(string,"hout:%d",(int)Blowback_hour);
OLED_ShowString(32,0,string);
i = sprintf(string,"fixed time:%d",(int)eerom.save_data.Blowback_cycle);
OLED_ShowString(0,2,string);
Blowback();
OLED_Clear();
}
if(zero_seting_hour>=eerom.save_data.zero_seting_cycle)
{
zero_seting_hour = 0;
OLED_Clear();
OLED_ShowCHinese(0,0,12);
OLED_ShowCHinese(16,0,35);
i = sprintf(string,"fixed time");
OLED_ShowString(32,0,string);
zero_setting();
OLED_Clear();
}
TCON_bit.TR0 = 1;
后来改成
PSW_bit.CY = 0;
if(PSW_bit.CY==0)
{
TCON_bit.TR0 = 0; //停止定时器计时,防止改变小时变量影响if比较
if(eerom.save_data.Blowback_cycle==Blowback_hour)
{
Blowback_hour = 0;
OLED_Clear();
OLED_ShowCHinese(0,0,30);
OLED_ShowCHinese(16,0,31);
/*
i = sprintf(string,"fixed time");
OLED_ShowString(32,0,string);
*/
i = sprintf(string,"hout:%d",(int)Blowback_hour);
OLED_ShowString(32,0,string);
i = sprintf(string,"fixed time:%d",(int)eerom.save_data.Blowback_cycle);
OLED_ShowString(0,2,string);
Blowback();
OLED_Clear();
}
if(zero_seting_hour>=eerom.save_data.zero_seting_cycle)
{
zero_seting_hour = 0;
OLED_Clear();
OLED_ShowCHinese(0,0,12);
OLED_ShowCHinese(16,0,35);
i = sprintf(string,"fixed time");
OLED_ShowString(32,0,string);
zero_setting();
OLED_Clear();
}
TCON_bit.TR0 = 1;
}
这样就解决了,
您需要登录后才可以回复 登录 | 注册