Instruction List (IL)
A program written in IL language is a list of instructions. Each instruction is written on one line of text. An instruction may have one or more operands. Operands are variables or constant expressions. Each instruction may begin with a label, followed by the ":" character. Labels are used as destination for jump instructions.
The Workbench Studio allows you to mix ST and IL languages in textual program. ST is the default language. When you enter IL instructions, the program must be entered between BEGIN_IL and END_IL keywords, such as in the following example:
|
BEGIN_IL |
Comments
Comment texts can be entered at the end of a line containing an instruction. Comment texts have no meaning for the execution of the program. A comment text must begin with "(*" and end with "*)". Comments may also be entered on empty lines (with no instruction), and on several lines (i.e. a comment text may include line breaks). Comment texts cannot be nested.
Data flow
An IL complete statement is made of instructions for:
- first: evaluating an expression (called current result).
- then: use the current result for performing actions.
Evaluation of expressions
The order of instructions in the program is the one used for evaluating expressions, unless parenthesis are inserted. Below are the available instructions for evaluation of expressions:
Instruction |
Operand |
Meaning |
any type |
Loads the operand in the current result. |
|
boolean |
AND between the operand and the current result. |
|
boolean |
OR between the operand and the current result. |
|
boolean |
XOR between the operand and the current result. |
|
numerical |
Adds the operand and the current result. |
|
numerical |
Subtract the operand from the current result. |
|
numerical |
Multiply the operand and the current result. |
|
numerical |
Divide the current result by the operand. |
|
numerical |
Compares the result with the operand. |
|
numerical |
Compares the result with the operand. |
|
numerical |
Compares the result with the operand. |
|
numerical |
Compares the result with the operand. |
|
numerical |
Compares the result with the operand. |
|
NE |
numerical |
Compares the result with the operand. |
Function call |
func. arguments |
Calls a function. |
|
Changes the execution folder. |
|
Instructions suffixed by N uses the boolean negation of the operand. |
Actions
The following instructions perform actions according to the value of currrent result. Some of these instructions do not need a current result to be evaluated:
Instruction |
Operand |
Meaning |
any type |
Stores the current result in the operand. |
|
label |
Jump to a label - no current result needed. |
|
label |
Jump to a label if the current result is TRUE. |
|
label |
Jump to a label if the current result is FALSE. |
|
boolean |
Sets the operand to TRUE if the current result is TRUE. |
|
boolean |
Sets the operand to FALSE if the current result is TRUE. |
|
f. block |
Calls a function block (no current result needed). |
|
f. block |
Calls a function block if the current result is TRUE. |
|
f. block |
Calls a function block if the current result is FALSE. |
|
Instructions suffixed by N uses the boolean negation of the operand. |
Other topics in this chapter |
Instruction List (IL) |
IEC 61131-3 Automation platform > Programming - Reference guide > Programming languages - Overview > Instruction List (IL) |
Created with the Personal Edition of HelpNDoc: Elevate your documentation to new heights with HelpNDoc's built-in SEO