问答

汇集网友智慧,解决技术难题

lsc501

TA的家园币:26  

  • stc的bug吗?

    如下的程序,工作大约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,"fixedtime");OLED_ShowString(32,0,string);*/i=sprintf(string,"hout:%d",(int)Blowback_hour);OLED_ShowString(32,0,string);i=sprintf(string,"fixedtime:%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,"fixedtime");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,"fixedtime");OLED_ShowString(32,0,string);*/i=sprintf(string,"hout:%d",(int)Blowback_hour);OLED_ShowString(32,0,string);i=sprintf(string,"fixedtime:%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,"fixedtime");OLED_ShowString(32,0,string);zero_setting();OLED_Clear();}TCON_bit.TR0=1;}这样就解决了,

    stc BUG string LED OLED

    2022-03-14 0