Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
PROGRAM¶
A program is the top-level executable unit in IEC 61131-3. Programs are instantiated within resources and scheduled by tasks.
IEC 61131-3 |
Section 2.5.3 |
Support |
Supported |
Syntax¶
PROGRAM program_name
variable_declarations
statement_list
END_PROGRAM
Example¶
PROGRAM main
VAR
counter : INT := 0;
END_VAR
counter := counter + 1;
END_PROGRAM
Programs can contain local variables (VAR), input variables
(VAR_INPUT), and output variables (VAR_OUTPUT). Unlike functions,
programs retain their variable values between execution cycles.
See Also¶
FUNCTION_BLOCK — stateful callable unit
FUNCTION — stateless callable unit
TASK — execution scheduling
CONFIGURATION — deployment container