中级会员
 
- 积分
- 304
- 金钱
- 304
- 注册时间
- 2016-12-6
- 在线时间
- 40 小时
|
5金钱
本帖最后由 春心荡漾 于 2017-4-6 12:49 编辑
给为大神可以告诉我下为什么下面两段代码的执行效果不同吗?万分感谢!!!
第一段:[mw_shl_code=applescript,true]void RTC_IRQHandler(void)
{
if(RTC_GetITStatus(RTC_IT_SEC))
{
// TimeDisplay =1;
RTC_ClearITPendingBit(RTC_IT_SEC);
RTC_WaitForLastTask();
if (RTC_GetCounter() == 0x00015180){
RTC_SetCounter(0x00);
RTC_WaitForLastTask();
}
}
}
while(1)
{
// if(TimeDisplay == 1)
{
Time_Display(RTC_GetCounter());
// TimeDisplay = 0;
}
}[/mw_shl_code]
第二段:
[mw_shl_code=applescript,true]void RTC_IRQHandler(void)
{
if(RTC_GetITStatus(RTC_IT_SEC))
{
TimeDisplay =1;
RTC_ClearITPendingBit(RTC_IT_SEC);
RTC_WaitForLastTask();
if (RTC_GetCounter() == 0x00015180){
RTC_SetCounter(0x00);
RTC_WaitForLastTask();
}
}
}
while(1)
{
if(TimeDisplay == 1)
{
Time_Display(RTC_GetCounter());
TimeDisplay = 0;
}
}[/mw_shl_code]
区别就在于有没有添加显示标志
第一种显示效果是在到达00:00:00是正常的,第二种的话到达23:59:58后直接跳到00:00:00,然后00:00:00停顿一秒钟
|
|