Uploaded by Adam Lassak

STL-cheat-sheet-by-category

advertisement
Siemens S7
Statement List (STL)
by category
Bit logic
A
And
AN
And Not
O
Or
ON
Or Not
X
Exclusive Or
XN
Exclusive Or Not
FN
Edge Negative
FP
Edge Positive
( )
Nesting
=
Assign
R
Reset
S
Set
NOT
Negate RLO
SET
Set RLO (=1)
CLR
Clear RLO (=O)
Save RLO in BR
SAVE
Register
Convert
BTI
ITB
BTD
ITD
DTB
DTR
INVI
INVD
NEGI
NEGD
NEGR
CAW
CAD
RND
TRUNC
RNDRND+
BCD to Integer
Integer to BCD
BCD to Integer
Integer to Double
Integer
Double Integer to
BCD
Double Integer to
Floating-Point
Ones Complement
Integer
Ones Complement
Double Integer
Twos Complement
Integer
Twos Complement
Double Integer
Negate FloatingPoint Number
Change Byte
Sequence in ACC1
Word
Change Byte
Sequence in ACC1
Double
Round
Truncate
Round to Lower
Double Integer
Round to Upper
Double Integer
Note: For Compare and Math
I
Integer (16 bit)
Double Integer
D
(32 bit)
Real – Floating
R
Point (32 bit)
Compare
==I ==D
==R
<>I <>D
<>R
>I >D
>R
>=I >=D
>=R
<I <D
<R
<=I <=D
<=R
if true RLO = 1
ACC2 is equal to
ACC1
ACC2 is not equal
to ACC1
ACC2 is greater
then to ACC1
ACC2 is greater
then equal to ACC1
ACC2 is less then
to ACC1
ACC2 is less then
equal to ACC1
Math
+
+I +D
+R
-I -D
-R
*I *D
*R
/I /D
/R
MOD
Add Integer
Constant (16, 32Bit)
Add ACC1 and ACC2
Subtract ACC1 from
ACC2
Multiply ACC1 and
ACC2
Divide ACC2 by
ACC1
Division Remainder
Double Integer
Floating Point Math
ABS
Absolute Value
ACOS
Arc Cosine
ASIN
Arc Sine
ATAN
Arc Tangent
COS
Cosine of Angles
EXP
Exponential Value
LN
Natural Logarithm
SIN
Sine of Angles
SQR
Square
SQRT
Square Root
TAN
Tangent of Angles
Word logic
AW
AND Word
AD
AND Double Word
OW
OR Word
OD
OR Double Word
XOW
Exclusive Or Word
Exclusive Or
XOD
Double Word
Shift/Rotate
SSI
Shift Sign Integer
Shift Sign Double
SSD
Integer
SLW
Shift Left Word
SRW
Shift Right Word
Shift Left Double
SLD
Word
Shift Right Double
SRD
Word
Rotate Left Double
RLD
Word
Rotate Right
RRD
Double Word
Rotate ACC1 Left
RLDA
via CC 1
Rotate ACC1 Right
RRDA
via CC 1
Accumulator
Toggle ACC1 with
TAK
ACC2
POP
Pop accumulators
PUSH
Push accumulators
ENT
Enter ACC Stack
LEAVE
Leave ACC Stack
DEC
Decrement ACC
INC
Increment ACC
Add ACC1 to
+AR1
Address Register 1
Add ACC1 to
+AR2
Address Register 2
Program Display
BLD
Instruction (Null)
NOP 0
Null Instruction
Formats
B#
W#
L#
S5Time#
T#
D#
TOD#
C#
P#
2#
16#
#Symbol
//
Byte (8 bit)
Word (16 bit)
Long (32 bit)
S5 Time
(2H46M30S0MS)
IEC Time
(24D20H31M23S648MS)
IEC Date
(2007-10-28)
Time of Day
(23:59:59.999)
BCD
Pointer Address
Binary
Hexadecimal
Local stack
variable
Comment
Program Control
CALL
Call FC,FB,SFC,SFB
Example parameter passing
CALL FC1 or FB1, DB1
PARAM1 := I0.0
PARAM2 := “Example”.Test
CC
Conditional Call
UC
Unconditional Call
BE
Block End
Block End
BEC
Conditional
Block End
BEU
Unconditional
Save RLO in MCR
MCR(
Stack, Begin MCR
)MCR
End MCR
MCRA
Activate MCR
MCRD
Deactivate MCR
Load
L
Jumps
JU
JL
JC
JCN
LAR2 <D>
JCB
JNB
JBI
JNBI
JO
JOS
JZ
JN
JP
JM
JPZ
JMZ
JUO
LOOP
Jump Unconditional
Jump to Labels
Jump if RLO = 1
Jump if RLO = 0
Jump if RLO = 1 with
BR
Jump if RLO = 0 with
BR
Jump if BR = 1
Jump if BR = 0
Jump if OV = 1
Jump if OS = 1
Jump if Zero
Jump if Not Zero
Jump if Plus
Jump if Minus
Jump if Plus or Zero
Jump if Minus or
Zero
Jump if Unordered
Loop
Data Blocks
OPN
Open a Data Block
Exchange Shared DB
CDB
and Instance DB
Load Length of
L DBLG
Shared DB in ACC1
Load Number of
L DBNO
Shared DB in ACC1
Load Length of
L DILG
Instance DB in ACC1
L DINO
L STW
LAR1
LAR1 <D>
LAR1 AR2
LAR2
CAR
Transfer
T
T STW
TAR1
TAR1 <D>
TAR1 AR2
TAR2
TAR2 <D>
Load
Load Status Word
into ACC1
Load Address
Register 1 from
ACC1
Load Address
Register 1 with
Double Integer
(32-Bit Pointer)
Load Address
Register 1
from Address
Register 2
Load Address
Register 2 from
ACC1
Load Address
Register 2 with
Double Integer
(32-Bit Pointer)
Exchange Address
Register 1
with Address
Register 2
Transfer
Transfer ACC1
into Status Word
Transfer Address
Register 1 to
ACC1
Transfer Address
Register 1 to
Destination (32Bit Pointer)
Transfer Address
Register 1
to Address
Register 2
Transfer Address
Register 2 to
ACC1
Transfer Address
Register 2 to
Destination (32Bit Pointer)
Timers/Counters (0 to 255)
Enable Timer/Counter
FR
(Free)
Load Current
Timer/Counter Value
L
into ACC1 as Integer
(i.e. L T 32)
Load Current
Timer/Counter Value
LC
into ACC1 as BCD
(i.e. LC T 32)
R
Reset Timer/Counter
Set Counter Preset
S
Value (i.e. S C 15)
SD
On-Delay Timer
Retentive On-Delay
SS
Timer
SP
Pulse Timer
SF
Off-Delay Timer
SE
Extended Pulse Timer
CD
Counter Down
CU
Counter Up
OBs
1
10-17
20-23
30-38
40-47
80
81
82
83
84
85
86
87
100
101
102
121
122
Main Program Scan
Time of Day
Time Delay
Cyclic (Periodic)
Hardware
Time Error
Power Supply Error
Diagnostic Interrupt
Insert/Remove Module
Interrupt
CPU Hardware Fault
Program Cycle Error
Rack Failure –
Missing Profibus
device
Communication Error
Warm restart
Hot restart
Cold restart
Programming Error
I/O Access Error
Load Number of
Instance DB in ACC1
v2.0
Download