4-10
S7-200 Programmable Controller, CPU 210
C79000-G7076-C235-01
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 Editor - project1.ob1
//Conveyor Line Program
NETWORK 1
//Start Motor:
LD
“Start1”
//When I0.0 is on
AN
“E-Stop1”
//and I0.1 is not on,
=
Q0.0
//then turn on conveyor motor.
NETWORK 2
//End of Program
MEND
STL
Begin each comment with
a double slash (//).
Instruction
Operand
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.
S0
S1
S2
S3
S4
S5
S6
S7
Stack 0
- First stack level, or top of the stack
Stack 1
- Second stack level
Stack 2
- Third stack level
Stack 3
- Fourth stack level
Stack 4
- Fifth stack level
Stack 5
- Sixth stack level
Stack 6
- Seventh stack level
Stack 7
- Eighth stack level
Bits of the Logic Stack
Load (LD)
Loads a new value (nv) onto the
stack.
Before Load
After Load
iv7 is lost.
And (A)
ANDs a new value (nv) with the top
of stack.
S0 = iv0 * nv
Or (O)
ORs a new value (nv) with the top
of stack.
S0 = iv0 + nv
iv0
iv1
iv2
iv3
iv4
iv5
iv6
iv7
nv
iv0
iv1
iv2
iv3
iv4
iv5
iv6
Before And
After And
iv0
iv1
iv2
iv3
iv4
iv5
iv6
iv7
S0
iv1
iv2
iv3
iv4
iv5
iv6
iv7
Before Or
After Or
iv0
iv1
iv2
iv3
iv4
iv5
iv6
iv7
S0
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
Basic Concepts for Programming the CPU 210
Содержание Simatic S7-200 CPU 210
Страница 10: ...x S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 Contents ...
Страница 68: ...3 28 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 Getting Started with a Sample Program ...
Страница 116: ...A 16 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 CPU 210 Data Sheets ...
Страница 126: ...F 2 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 CPU 210 Order Numbers ...
Страница 138: ...Index 12 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 Index ...