Attention
IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.
Retention¶
Retention qualifiers control whether variables preserve their values across power cycles and program restarts.
IEC 61131-3 |
Section 2.4.3 |
Support |
Not yet supported |
Qualifiers¶
Qualifier |
Description |
|---|---|
|
Value is preserved across power cycles |
|
Value is reset to initial value on restart |
|
Value cannot be modified after initialization |
Example¶
PROGRAM main
VAR RETAIN
run_hours : DINT := 0;
END_VAR
VAR CONSTANT
MAX_TEMP : INT := 150;
END_VAR
VAR
current_temp : INT;
END_VAR
run_hours := run_hours + 1;
END_PROGRAM
See Also¶
Variable Declarations — basic variable syntax
Initial Values — initialization