初级会员
- 积分
- 99
- 金钱
- 99
- 注册时间
- 2017-12-14
- 在线时间
- 32 小时
|
1金钱
求教大神,FreeRtos延时问题,在任务主体内部的for循环下面加了绝对延时,总共延时3s,但是实际测下来2s都不到,是哪里出了问题???
if(!GPIO_ReadInputDataBit(PowerONOFFState_GPIO, PowerONOFFState_GPIO_Pin))
{
while(!GPIO_ReadInputDataBit(PowerONOFFState_GPIO, PowerONOFFState_GPIO_Pin));
if (0 == g_AlarmFlg || g_AlarmMode == KeyDevicesAlarmMode) //无报警,关机
{
g_ShutDownFlg = 1;//关机标志位置1
vTaskSuspend(SystemWorkTaskToSuspend);//挂起系统工作任务
DisplayShutDownFont();//清屏显示关闭主机
WorkTimeReset();//泄气延迟3s
for(i = 0; i < 3; i++)
{
System_Delay(1000);
}
GPIO_OFF(PowerONOFF_GPIO,PowerONOFF_GPIO_Pin);//关闭电源
}
else //有报警清除报警位,重新自检
{
while( 0 == g_ReturnFlg)
System_Delay(100);
vTaskSuspend(AlarmTaskToSuspend);
vTaskSuspend(AlarmLEDTaskToSuspend);
g_WorkProcess = SelfTestProcess;
g_AlarmMode = NoAlarmMode;
g_AlarmFlg = 0;
g_SelfTestOverFlg = 0;
}
}
|
|