Introduction to Instruction List (IL)



The Instruction List (IL) language defined by IEC 61131-3 is a low-level language
comparable to the assembly language programming of microprocessors. 

The IL language has a set of instructions to handle variable assignment, conditional statements, simple arithmetic, and function block calling. 

The IL and ST languages share many of the same elements. Namely, the definition of variables and direct physical PLC addresses are identical for both languages.


Instructions


As illustrated below table, an instruction list is composed of a sequence of instructions. 
Each instruction shall begin on a new line and shall contain an operator with optional modifiers, and, if necessary for the particular operation, one or more operands separated by commas. 
Operands can be any of the data representations for variables.
The instruction can be preceded by an identifying label followed by a colon (:). 
A comment, if present, shall be the last element on a line. Empty lines can be inserted between instructions.

Operators, modifiers and operands

Standard operators with their allowed modifiers and operands shall be as listed in below table. 
Unless otherwise defined in table 52, the semantics of the operators shall be
result := result OP operand
That is, the value of the expression being evaluated is replaced by its current value operated upon by the operator with respect to the operand. For instance, the instruction 
AND %IX1 is interpreted as
result := result AND %IX1
The comparison operators shall be interpreted with the current result to the left of the comparison and the operand to the right, with a Boolean result. 
For instance, the instruction "GT %IW10" will have the Boolean result 1 if the current result is greater than the value of Input Word 10, and the Boolean result 0 otherwise.

The modifier "N" indicates Boolean negation of the operand. 
For instance, the instruction ANDN %IX2 is interpreted as
result := result AND NOT %IX2

The left parenthesis modifier "(" indicates that evaluation of the operator shall be deferred until a right parenthesis operator ")" is encountered, e.g., the sequence of instructions
AND( %IX1 OR %IX2 )
shall be interpreted as
result := result AND (%IX1 OR %IX2)

The modifier "C" indicates that the associated instruction shall be performed only if the value of the currently evaluated result is Boolean 1 (or Boolean 0 if the operator is combined with the "N" modifier).

Functions and function blocks

Functions shall be invoked by placing the function name in the operator field. 
The current result shall be used as the first argument of the function. 
Additional arguments, if required, shall be given in the operand field. The value returned by a function upon the successful execution of a RET instruction or upon reaching the physical end of the function shall become the "current result" 
Function blocks can be invoked conditionally and unconditionally via the CAL (Call) operator listed above. As shown below table, this invocation can take one of three forms. 

Standard function block input operators

Below table summarizes the standard function block input operators for Instruction List


Comments

Popular posts from this blog

Control system documentation

Introduction to sequential function chart (SFC)

Introduction to structure text (ST)