System variables - PLC state
Available from firmware version 2025.0.
The PLC Manager provides status information on the PLC via the system variable PLC_STATE
.
The struct data type PLC_STATE_TYPE
is structured as follows:
PLC_STATE_TYPE : STRUCT
VALUE : UDINT; // PLC State (Ready, Stop, Running, Halt) as numerical value (1..4)
VALUE_INFO : STRING; // PLC State human readable, e.g. for display in HMI
FLAGS : DWORD; // Flags without the state (Forcing, Debugging, Error etc.) as Bitstring
FLAGS_INFO : STRING; // Flags in human readable form, e.g. for display in HMI
END_STRUCT
Note: If several bits are set at the same time, the order of the STRING
values may vary.
There are the following PLC state values:
PLC state | Decimal value | Description |
Ready |
1 | The firmware is set up. The PLC is ready, but not loaded. |
Stop |
2 | The PLC is loaded and set up, but not started. |
Running |
3 | The PLC is started. |
Halt |
4 | The PLC is halted for debugging purposes. |
Additional to the PLC state there are flags stored in the PLC_STATE
system variable that give more detailed information about the current state. Each flag is represented by one bit. It is possible that multiple flags are set. There are the following state flags:
PLC state flag | Filter mask value in decimal format (2^bit) | Description |
Warning |
2^6 | An unspecified warning is occurred. |
Error |
2^7 | An unspecified error or exception is occurred. |
Suspended |
2^8 | PLC cannot start because it is prevented by a component. |
FatalError |
2^9 | An unspecified fatal error or exception is occurred. |
Blocked |
2^10 | PLC cannot load because it is prevented by a component. |
SystemError |
2^11 | An SystemError occurred while setting up the system. |
Loading |
2^12 | The PLC is loading the PLC components. |
Starting |
2^13 | The PLC is starting the PLC components. |
Stopping |
2^14 | The PLC is stopping the PLC components. |
Resetting |
2^15 | The PLC is resetting the PLC components. |
Changing |
2^16 | The PLC is changing the configuration. |
Hot |
2^17 | The PLC is stopped in hot state. All data remains. |
Forcing |
2^18 | One or more variables are forced by the GDS. |
Debugging |
2^19 | One or more breakpoints are set. |
Warm |
2^20 | The PLC is stopped in warm state. Retain data has been restored. |
StartingDelayed |
2^21 | The PLC is about to start, but due to component conditions the start has to be delayed. |
DcgFailed |
2^29 | The PLC tries to perform a change operation, but the project contains an error. |
DcgNotPossible |
2^30 | The PLC tries to perform a change operation, but it is not possible due to unacceptable changes. |
DcgRealTimeViolation |
2^31 | The PLC tries to perform a change operation, but it is not possible in real time. |
• Published/reviewed: 2025-06-06 ✿ Revision 080 •