Instruction List (IL)

Help Contents

Introduction

Instruction List (IL) is a list of instructions, similar to assembly language, that are run in order.

Instruction List is one of the five programming languages defined the IEC 61131-3 standard.

Instruction List Syntax

The Instruction List uses this syntax:

instruction-list ::= { instruction-item }

instruction-item ::= [ label | instruction ]

label ::= identifier ':'

instruction ::= <See table below>

Supported Instructions

Fernhill SCADA supports these types of instruction:

Load and Store Instructions

These load and store instructions are supported:

InstructionComment
LD Expression Sets the current result to the value of Expression. For example:
LD 1
LD X
LD X[0]
ST Variable Reference Stores the current result to a variable. For example:
ST X
ST X[0]
S Variable Reference If the current result is TRUE, sets Variable Reference to TRUE. For example:
S X
R Variable Reference If the current result is TRUE, resets Variable Reference to FALSE. For example:
R X

Logical Instructions

These logical instructions are supported:

InstructionComment
AND Expression Sets the current result to: Current Result AND Expression. For example:
AND 16#FF
ANDN Expression Sets the current result to: Current Result AND NOT( Expression ). For example:
ANDN 16#FF
OR Expression Sets the current result to: Current Result OR Expression. For example:
OR 16#80
ORN Expression Sets the current result to: Current Result OR NOT( Expression ). For example:
ORN 16#80
XOR Expression Sets the current result to: Current Result XOR Expression. For example:
XOR 16#F
XORN Expression Sets the current result to: Current Result XOR NOT( Expression ). For example:
XORN 16#F
NOT Sets the current result to: NOT Current Result. For example:
NOT

Arithmetic Instructions

These arithmetic instructions are supported:

InstructionComment
ADD Expression Sets the current result to: Current Result + Expression. For example:
ADD 1
SUB Expression Sets the current result to: Current Result - Expression. For example:
SUB 1
MUL Expression Sets the current result to: Current Result * Expression. For example:
MUL 5
DIV Expression Sets the current result to: Current Result / Expression. For example:
DIV 10
MOD Expression Sets the current result to: Current Result MOD Expression. For example:
MOD 7

Comparison Instructions

These comparison instructions are supported:

InstructionComment
GT Expression Sets the current result to: Current Result > Expression. For example:
GT 7
GE Expression Sets the current result to: Current Result >= Expression. For example:
GE 7
EQ Expression Sets the current result to: Current Result = Expression. For example:
EQ 7
NE Expression Sets the current result to: Current Result <> Expression. For example:
NE 7
LT Expression Sets the current result to: Current Result < Expression. For example:
LT 7
LE Expression Sets the current result to: Current Result <= Expression. For example:
LE 7

After a comparison instruction the current value will be either TRUE or FALSE.

Control Flow Instructions

These control flow instructions are supported:

InstructionComment
JMP Label Jump to Label. For example:
JMP Start
JMPC Label Jump to Label if the current value is TRUE. For example:
JMPC Found
JMPNC Label Jump to Label if the current value is FALSE. For example:
JMPNC Error

Where to use Instruction List in Fernhill SCADA

In Fernhill SCADA you can use Instruction List code in:

Further Information

Common Elements

To learn about IEC 61131-3 Common Elements you can use in IL programs and functions.

Glossary

For the meaning of terms used in Fernhill SCADA.