Instruction List
See also: IEC 61131 Language Editor Programming
See also: Enhanced IEC 61131 Guide
Topic Menu
Common Elements to IEC Textual Languages (IL and ST)
The IL editor is a powerful language sensitive text editor dedicated to IEC 61131-3 languages. The editor supports advanced graphic features such as drag and drop, syntax coloring and active tooltips for efficient input and test of programs in 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 ":" (colon) character. Labels are used as destination for jump instructions.
IL instructions in the program must be entered between BEGIN_IL and END_IL keywords, such as in the following example:
Return to the Top: Instruction List
Drag and Drop Features in IL
The ST/IL editor supports powerful drag and drop features that helps the users to develop and test programs.
The User can:
-
drag text (words or lines) from the ST/IL editor to another application (such as a text editor)
-
do the opposite
-
drag a variable symbol from the Program Variables Window to the ST/IL editor
-
drag a variable symbol from the ST/IL editor to the watch list (*)
(*) When dragging the symbol of an array to the watch list, all items of the array are added to the watch list.
Comments in IL
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 in IL
An IL complete statement is made of instructions for:
first: evaluating an expression (called current result) then: use the current result for performing actions
Return to the Top: Instruction List
Evaluation of Expressions in IL
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 |
---|---|---|
LD/LDN, see Variable Assignment | Any Type | Loads the operand in the current result |
AND | AND between the operand and the current result | |
OR | OR between the operand and the current result | |
XOR | XOR between the operand and the current result | |
Add | Adds the operand and the current result | |
SUB | Subtracts the operand from the current result | |
MUL | Multiplies the operand and the current result | |
DIV | Divides the current result by the operand | |
>GT | Greater Than - compares the current result with the operand | |
>=GE | Greater Than or Equal to- compares the current result with the operand | |
<LT | Less Than - compares the current result with the operand | |
<=LE | Less Than or Equal to- compares the current result with the operand | |
=EQ | Equal to- compares the current result with the operand | |
<>NE | Not Equal- compares the current result with the operand | |
Function Calls | Function Arguments | Calls a function |
Parentheses | Changes the execution order |
Note: Instructions suffixed by "N" uses the Boolean negation of the operand.
Return to the Top: Instruction List
Actions in IL
The following instructions perform actions according to the value of current result. Some of these instructions do not need a current result to be evaluated:
Instruction | Operand | Meaning |
---|---|---|
ST/STN - | Any type | Stores the current result in the operand |
- JMP | Label | Jumps to a label - no current result needed |
- JMPC, JMPCN | Label | Jumps to a label if the current result is TRUE |
S - See Boolean Operations for IEC | Boolean Boolean- [Data Type BOOL] - A single bit, binary value, or register/variable. Boolean points have only two possible values, 'TRUE' or 'FALSE'. | Sets the operand to TRUE if the current result is TRUE |
R - See Boolean Operations for IEC | Boolean | Sets the operand to FALSE if the current result is TRUE |
CAL - See IEC Editors and Basic Operations | Function Block | Calls a function block (no current result needed) |
CALC / CALN- See IEC Editors and Basic Operations | Numerical | Calls a function block if the current result is TRUE |
Note: Instructions suffixed by "N" uses the Boolean negation of the operand.
Auto Completion of Words in IL
The ST/IL editor includes powerful commands for automatic completion of typed words, according to declared variables and data types.
-
Auto completion of a variable name - If the user enter the first letters of a variable name, the user can hit the CTRL+SPACE keys for automatically completing the name. A pop-up list is displayed with possible choices if several declared variable names match the type characters.
-
Selection of FB member - When the user type the name of a function block instance (use either as an instance or a data structure), pressing the point "." after the name of the instance opens a popup list with the names of possible members.
-
Other syntax related commands - When lines are selected, the user can automatically indent them. Press TAB or Shift+TAB keys to shift the lines to the left or to the right, by adding or removing blank characters on the left.
Return to the Top: Instruction List