2.2 Function of "plcClose"
PLC task executes "plcClose" function when detects system shut down. In this function can clear I/O, flag and variable. For example, all auxiliary devices shall turn off when system shut down. Usually, flow control can not in this function.
void PLCAPI plcClose(struct Status &sts, struct PlcBlock &plc){ }
In order to prevent misoperation of auxiliary system during shutdown, you can set the state of output point during shutdown in plcClose to prevent misoperation of auxiliary system.
plcClose example:
#define inverterRun (plc.gdo[0].bit.bit00) //Output 0 is inverter run signal
//1: turn on
//0: turn off
int inverterFlag; //inverter flag
int inverterSpeed; //inverter speed
enum{IDLE=0, START, FINISH};
void PLCAPI plcClose(struct Status &sts, struct PlcBlock &plc){
inverterRun = 0;
inverterFlag = IDLE;
inverterSpeed = 0;
}