Understanding The Statement List Instructions - Siemens Simatic S7-200 CPU 210 System Manual

Table of Contents

Advertisement

Basic Concepts for Programming the CPU 210

Understanding the Statement List Instructions

Statement list (STL) is a programming language in which each statement in your program
includes an instruction that uses a mnemonic abbreviation to represent a function of the
CPU. You combine these instructions into a program to produce the control logic for your
application. Figure 4-8 shows the basic elements of a statement list program.
STL
STL Editor - project1.ob1
//Conveyor Line Program
NETWORK 1
LD
"Start1"
AN
"E-Stop1"
=
Q0.0
NETWORK 2
MEND
Instruction
Figure 4-8
STL Editor Window with Sample Program
The STL instructions use a logic stack for solving your control logic. As shown in Figure 4-9,
this logic stack is eight bits deep by one bit wide. Most of the STL instructions work either
with the first bit or with the first and the second bits of the logic stack. New values can be
"pushed" (or added) onto the stack; when the top two bits of the stack are combined, the
stack is "popped" (reduced by one bit).
While most STL instructions only read the values in the logic stack, many STL instructions
also modify the values stored in the logic stack. Figure 4-9 shows three examples of how
three instructions use the logic stack.
Bits of the Logic Stack
Load (LD)
Loads a new value (nv) onto the
stack.
Before Load
iv0
iv1
iv2
iv3
iv4
iv5
iv6
iv7
In these examples, "iv0" to "iv7" identify the initial values of the logic stack, "nv" identifies a new value provided by the instruction, and
"S0" identifies the calculated value that is stored in the logic stack.
Figure 4-9
Logic Stack of the CPU 210
4-10
Begin each comment with
a double slash (//).
//Start Motor:
//When I0.0 is on
//and I0.1 is not on,
//then turn on conveyor motor.
//End of Program
Operand
S0
Stack 0
S1
Stack 1
S2
Stack 2
S3
Stack 3
S4
Stack 4
S5
Stack 5
S6
Stack 6
S7
Stack 7
And (A)
ANDs a new value (nv) with the top
of stack.
S0 = iv0 * nv
After Load
Before And
nv
iv0
iv0
iv1
iv1
iv2
iv2
iv3
iv3
iv4
iv4
iv5
iv5
iv6
iv6
iv7
iv7 is lost.
- First stack level, or top of the stack
- Second stack level
- Third stack level
- Fourth stack level
- Fifth stack level
- Sixth stack level
- Seventh stack level
- Eighth stack level
Or (O)
ORs a new value (nv) with the top
of stack.
S0 = iv0 + nv
After And
Before Or
S0
iv0
iv1
iv1
iv2
iv2
iv3
iv3
iv4
iv4
iv5
iv5
iv6
iv6
iv7
iv7
S7-200 Programmable Controller, CPU 210
C79000-G7076-C235-01
After Or
S0
iv1
iv2
iv3
iv4
iv5
iv6
iv7

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents