Introduction

Using the Instruction list programming language (IL), you can call function blocks and functions conditionally or unconditionally, perform assignments and make jumps conditionally or unconditionally within a section.

Instructions

An instruction list is composed of a series of instructions.

Each instruction begins on a new line and consists of:

Should several operands be used, they are separated by commas. It is possible for a Label to be in front of the instruction. This label is followed by a colon. A Comment can follow the instruction.

Example:

Structure of the Programming Language

IL is a so-called accumulator orientated language, i.e. each instruction uses or alters the current content of the accumulator (a form of internal cache). IEC 61131 refers to this accumulator as the "result".

For this reason, an instruction list should always begin with the LD operand ("Load in accumulator command").

Example of an addition:

Command

Meaning

LD 10

Load the value 10 into the accumulator.

ADD 25

"25" is added to the contents of the accumulator.

ST A

The result is stored in the variable A.

The content of the variable A and the accumulator is now 35. Any further instruction will work with accumulator contents "35" if it does not begin with LD.

Compare operations likewise always refer to the accumulator. The Boolean result of the comparison is stored in the accumulator and therefore becomes the current accumulator content.

Example of a comparison:

Command

Meaning

LD B

The value B is loaded into the accumulator.

GT 10

10 is compared with the contents of the accumulator.

ST A

The result of the comparison is stored in the variable A.

If B is less than or equal to 10, the value of both variable A and the accumulator content is 0 (FALSE). If B is greater than 10, the value of both variable A and the accumulator content is 1 (TRUE).

Section Size

The length of an instruction line is limited to 300 characters.

The length of an IL section is not limited within the programming environment. The length of an IL section is usually limited by the size of the PLC memory.

NOTE: There is no size limitation for section, but sometime when using a large amount of literal assignments or some specific instructions, a section can generate a Code generation failure during an application build. Then the solution is to split the section in two or more sections to build the application.

Syntax

Identifiers and Keywords are not case sensitive.

Spaces and tabs have no influence on the syntax and can be used as and when required,

Exception: Not allowed - spaces and tabs

  • keywords

  • literals

  • values

  • identifiers

  • variables and

  • limiter combinations [e.g. (* for comments)]

Execution Sequence

Instructions are executed line by line, from top to bottom. This sequence can be altered with the use of parentheses.

If, for example, A, B, C and D have the values 1, 2, 3 and 4, and are calculated as follows:

LD A
ADD B
SUB C
MUL C
ST E

the result in E will be 0.

In the case of the following calculation:

LD A
ADD B
SUB(
LD C
MUL D
)
ST E

the result in E will be -9.

Error Behavior

The following conditions are handled as an error when executing an expression:

  • Attempting to divide by 0.

  • Operands do not contain the correct data type for the operation.

  • The result of a numerical operation exceeds the value range of its data type

IEC Conformity

For a description of IEC conformity for the IL programming language, see IEC Conformity.