问答

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

伊桑黑

TA的家园币:166  

  • KF32LS201

    为什么程序执行到case100后不会跳到case200检测不到关机按键按下求大佬讲解voidPOWER_ON_OFF(void){staticuint8_tPOWER_ON_OFF_STATUS=0;staticuint32_tDET_COUNT=0;while(1){switch(POWER_ON_OFF_STATUS){case0://开机检测if(ONOFF_DET==0)DET_COUNT++;elseDET_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;case100:if(ONOFF_DET==0)DET_COUNT=0;elseDET_COUNT++;if(DET_COUNT>10000){POWER_ON_OFF_STATUS=200;DET_COUNT=0;}break;case200://关机检测if(ONOFF_DET==0)DET_COUNT++;elseDET_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;case250:if(ONOFF_DET==0)DET_COUNT=0;elseDET_COUNT++;if(DET_COUNT>100000){POWER_ON_OFF_STATUS=0;DET_COUNT=0;}break;default:break;}}}搜索复制

    se pow Power status

    2020-12-01 4