Example for a PLC programming language LD
Instruction list (STL)
|TwinCAT PLC Control: languages|
An instruction list (STL) consists of a sequence of instructions. Each instruction begins on a new line and contains an operator and, depending on the type of operation, one or more operands separated by commas.
An identifier can be placed in front of an instruction, followed by a colon (:).
A comment must be the last element on a line. Empty lines can be inserted between statements.
ST lint (* Comment *)
Modifiers and operators in IL
The following operators and modifiers can be used in the IL language.
- C for JMP, CAL, RET: The instruction is only executed if the result of the previous expression is TRUE.
- N for JMPC, CALC, RETC: The instruction is only executed if the result of the preceding expression is FALSE.
- N otherwise: negation of the operand (not of the accumulator)
In the following you will find a table of all operators in STL with their possible modifiers and the respective meaning:
|LD||N||Set the current result equal to the operand|
|ST||N||Save the current result to the operand position|
|S.||Set the Boolean operand to TRUE exactly if the current result is TRUE|
|AND||N, (||Bitwise AND|
|OR||N, (||Bitwise OR|
|XOR||(||Bitwise exclusive OR|
|JMP||CN||Jump to the mark|
|CAL||CN||Call function block|
|RET||CN||Leave the block and return to the caller if necessary|
|)||Evaluate deferred operation|
A list of all IEC operators can be found in the appendix.
Example of an STL program using some modifiers:
LD TRUE (* Load TRUE into the accumulator *)
ANDN BOOL1 (* execute AND with the negated value of the variable BOOL1 *)
JMPC mark (* if the result was TRUE, jump to the mark "mark" *)
LDN BOOL2 (* Save the negated value of *)
ST ERG (* BOOL2 in ERG *)
LD BOOL2 (* save the value of *)
ST ERG (* BOOL2 in ERG *)
In STL it is also possible to put brackets after an operation. The value of the bracket is then considered as the operand.
Here is the value of Erg 7. But if you put brackets:
The result here is the value for Erg 10, because the MUL operation is only evaluated when ")" is encountered; the operand for MUL is then 5.
- Hackers use premium VPNs 1
- The battery is saved by activating the dark mode
- How does social media analytics work
- What are the concepts of online advertising
- What is an ethnographic research paper
- What is a Polytechnic Diploma
- Where can I get unique phone accessories
- Is Infosys Nagpur functional
- Why do real estate agents need realtors
- How does the Facebook marketing platform work
- Why should substance abuse be controlled 1
- What is the JNU line
- Are chemically injected fruits healthy?
- What is Liverpool FC
- What is Zener Breakdown Voltage
- What's the best Fred Astaire movie
- What do Confucians think happens after death
- Can you describe your favorite birthday cake
- Has multi-party democracy failed in India
- Who used the first card?
- Will punk rock ever get popular again?
- How do beginners deal with stocks
- Will BMW ever take part in F1
- What is silicidation in VLSI manufacturing