| | |
| | | unsigned char FastFlicker=0; |
| | | |
| | | unsigned int Uart1IdelTimer = 0; |
| | | #if (ENABLE_PLC) |
| | | stBinProg1 * pProgs = (stBinProg1 *)STORE_PRG_BASE; |
| | | |
| | | #endif |
| | | uint32_t us1,us2,us3,us4,us5,us6; |
| | | |
| | | stKBusDef KBus1; |
| | |
| | | KMRunStat.WorkMode2=0; |
| | | |
| | | KMRunStat.WorkMode = storedKMSysCfg.theKMSysCfg.workmode; |
| | | |
| | | #if (ENABLE_PLC) |
| | | if (KMRunStat.WorkMode == 1){ |
| | | InitPLC(); |
| | | KMRunStat.WorkMode2 = KMem.CurJumperSW&0x20 ; |
| | | if (KMRunStat.WorkMode2) { |
| | | StartPLC(); } |
| | | } |
| | | |
| | | #endif |
| | | |
| | | #if (BOARD_TYPE == 15 || BOARD_TYPE == 16) |
| | | KWireLessInit(KMem.EffJumperSW&0x20,KMem.EffJumperSW&0x0f); |
| | | KWireLessStart(); |
| | |
| | | int haltick=HAL_GetTick(); |
| | | |
| | | int thisJumperSW=ReadJumperSW(); |
| | | |
| | | #if (ENABLE_PLC) |
| | | if (KMRunStat.WorkMode&1){ |
| | | if (thisJumperSW&0x20 && !(KMem.CurJumperSW&0x20)) // Run 开关 正 跳变。 |
| | | {StartPLC();} |
| | | if (!(thisJumperSW&0x20) && (KMem.CurJumperSW&0x20)) // Run 开关 负 跳变。 |
| | | {StopPLC();} |
| | | } |
| | | |
| | | #endif |
| | | KMem.CurJumperSW=thisJumperSW; |
| | | KMem.haltick=haltick; |
| | | // KMem.TotalRunTime=TotalRunTime; |
| | |
| | | #endif |
| | | |
| | | // pProgs = (stBinProg1 *) STORE_PRG_BASE; |
| | | |
| | | #if (ENABLE_PLC) |
| | | if ( KMRunStat.WorkMode==1 ) //&& bKBusMaster) |
| | | { |
| | | if (KMRunStat.nBinProgBank == 0){ |
| | |
| | | |
| | | ProcessPLCBinProg(pProgs, nSizeProg1); |
| | | } |
| | | |
| | | #endif |
| | | KMem.ScanTimeuS=us2-KMem.LastScanTime; |
| | | KMem.LastScanTime = us2; |
| | | if (KMem.ScanTimeuS < KMem.MinScanTimeuS) {KMem.MinScanTimeuS = KMem.ScanTimeuS;} |
| | |
| | | } |
| | | else |
| | | { |
| | | #if (ENABLE_PLC) |
| | | if (KMRunStat.WorkMode==1 ) { |
| | | if (PLCMem.bPLCRunning){SetRunLed(SlowFlicker);} |
| | | else {SetRunLed(0);} |
| | | } |
| | | else { |
| | | else |
| | | #endif |
| | | { |
| | | if (!KBus1.RunStat) SetRunLed(SlowFlicker); |
| | | else SetRunLed(FastFlicker); |
| | | } |