Statement list (STL) and the .awl export
The syntax of S7-200 statement list: networks and comments, the logic stack (LD, A, O, ALD, OLD, LPS, LRD, LPP), boxes, operands and constants, symbols, and the layout of a Micro/WIN .awl export. Paste your own program and run it.
35 min
On this page
STL (statement list; IEC name: instruction list) is the text form of an S7-200 program. Every LAD network has an STL equivalent, and File → Export writes a whole program as STL in an .awl file. Reading STL tells you exactly what the CPU executes.
Lines, networks, comments
Network 1 // Start/stop station
// RUN is set by START, held by its own contact, released by STOP_NC
LD START // START pressed
O RUN
A STOP_NC
= RUN
- A program is a list of networks;
Network n // titlestarts one. //starts a comment: on its own line after the network line (network comment) or after an instruction.- One instruction per line: a mnemonic (
LD,A,=,TON…) then its operands separated by commas. - Operands are addresses (
I0.0,VW100,T37), constants (+50,16#DB,2#1010,9.81) or symbols from the symbol table (START). The export may also quote symbols ("START").
The logic stack
Bit instructions work on a stack of bits. The top of the stack (TOS) is the current "power flow".
| Instruction | Effect on the stack | LAD equivalent |
|---|---|---|
LD bit / LDN bit | push bit / NOT bit | first contact of a rung or branch |
A bit / AN bit | TOS := TOS AND bit / AND NOT bit | contact in series |
O bit / ON bit | TOS := TOS OR bit / OR NOT bit | contact in parallel |
ALD | pop two, push their AND | two blocks in series |
OLD | pop two, push their OR | two blocks in parallel |
LPS / LRD / LPP | push a copy / read the copy / pop it | a branch point feeding several outputs |
NOT, EU, ED | invert TOS / rising / falling edge of TOS | NOT, P, N contacts |
= bit, S bit, n, R bit, n | write TOS / set / reset n bits if TOS | coils |
Boxes (TON, MOVW, +I, CTU…) execute when TOS is 1. A counter takes two or three stack levels (CU, then R; or CU, CD, R). The stack is 9 levels deep on the S7-200.
No errors: the program compiles.
Open Program status: the first column is the TOS after each instruction, live. Change the inputs on the panel and watch ALD and LPS/LPP do their work.
Predict first
How do you write (I0.0 OR I0.1) AND (I0.2 OR I0.3) → Q0.0 in STL?
The layout of an .awl export
ORGANIZATION_BLOCK MAIN:OB1
TITLE=Program comment
BEGIN
Network 1 // Network title
// Network comment
LD START
…
END_ORGANIZATION_BLOCK
SUBROUTINE_BLOCK SBR_0:SBR0
TITLE=Subroutine comment
VAR_INPUT
Speed:INT; // local variables of the subroutine
END_VAR
BEGIN
Network 1
…
END_SUBROUTINE_BLOCK
The main program is ORGANIZATION_BLOCK MAIN:OB1; subroutines and interrupt routines follow. The symbol table is not in the .awl: copy it from Micro/WIN (select the table, Ctrl+C) into the symbol box of the runner, or save it as a text file.
SIMATIC and International mnemonics
Micro/WIN can show STL with two mnemonic sets (Tools → Options → General). The booklet, the manual and this site use the SIMATIC set (LD, A, O, =). If an export looks unfamiliar, check that option before anything else.