-
KF32LS201
为什么程序执行到 case100 后不会跳到case200 检测不到关机按键按下 求大佬讲解 void POWER_ON_OFF(void) { static uint8_t POWER_ON_OFF_STATUS = 0; static uint32_t DET_COUNT = 0; while(1) { switch(POWER_ON_OFF_STATUS) { case 0: // 开机检测 if(ONOFF_DET == 0)DET_COUNT ++; else DET_COUNT = 0; if(DET_COUNT > 10000) { GPIO_Set_Output_Data_Bits(POWER_LOCK_PORT,POWER_LOCK,Bit_SET); GPIO_Set_Output_Data_Bits(LED1_PORT,LED1,Bit_RESET); POWER_ON_OFF_STATUS =100; DET_COUNT = 0; } break; case 100: if(ONOFF_DET == 0)DET_COUNT=0 ; else DET_COUNT++; if(DET_COUNT > 10000) { POWER_ON_OFF_STATUS = 200; DET_COUNT = 0; } break; case 200: //关机检测 if(ONOFF_DET == 0)DET_COUNT++; else DET_COUNT=0; if(DET_COUNT > 1000000) { GPIO_Set_Output_Data_Bits(POWER_LOCK_PORT,POWER_LOCK,Bit_SET); GPIO_Set_Output_Data_Bits(LED1_PORT,LED1,Bit_RESET); POWER_ON_OFF_STATUS = 250; DET_COUNT = 0; } break; case 250: if(ONOFF_DET == 0)DET_COUNT = 0; else DET_COUNT ++; if(DET_COUNT > 100000) { POWER_ON_OFF_STATUS = 0; DET_COUNT = 0; } break; default:break; } } } 搜索 [align=left]复制[/align]
944浏览量 4回复量 关注量