Professional Documents
Culture Documents
Siemens S7 SCL Cheat Sheet: Numeric Constants
Siemens S7 SCL Cheat Sheet: Numeric Constants
Class A
Conversion
Class B
BOOL_TO_INT
BOOL_TO_DINT
BYTE_TO_BOOL
BYTE_TO_CHAR
BYTE_TO_INT
BYTE_TO_DINT
CHAR_TO_BYTE
CHAR_TO_INT
DATE_TO_DINT
DINT_TO_DATE
DINT_TO_DWORD
DINT_TO_INT
DINT_TO_TIME
DINT_TO_TOD
DINT_TO_BOOL
DINT_TO_BYTE
DINT_TO_STRING
DINT_TO_WORD
DWORD_TO_BOOL
DWORD_TO_BYTE
DWORD_TO_DINT
DWORD_TO_REAL
DWORD_TO_WORD
DWORD_TO_INT
INT_TO_CHAR
INT_TO_WORD
INT_TO_BOOL
INT_TO_BYTE
INT_TO_DWORD
INT_TO_STRING
REAL_TO_DINT
REAL_TO_DWORD
REAL_TO_INT
REAL_TO_STRING
STRING_TO_CHAR
STRING_TO_INT
STRING_TO_DINT
STRING_TO_REAL
TIME_TO_DINT
TOD_TO_DINT
WORD_TO_BOOL
WORD_TO_BYTE
WORD_TO_INT
WORD_TO_DINT
WORD_TO_BLOCK_DB
BLOCK_DB_TO_WORD
BCD_TO_INT(x)
WORD_BCD_TO_INT(x)
INT_TO_BCD(x)
INT_TO_BCD_WORD(x)
BCD_TO_DINT(x)
DWORD_BCD_TO_DINT(x)
DINT_TO_BCD(x)
DINT_TO_BCD_DWORD(x)
Numeric
ABS
SQR
SQRT
EXP
EXPD
LN
LOG
ACOS
ASIN
ATAN
COS
SIN
TAN
Number
Square
Square Root
e to the power IN
10 to the power IN
Natural logarithm
Common logarithm
Arc cosine
Arc sine
Arc tangent
Cosine
Sine
Tangent
Count up
Count down
Count up/down
pulse timer
extended pulse
timer
on-delay timer
retentive on-delay
timer
off-delay timer
Constants
BOOL
BYTE
B#16#00
B#16#FF
BYTE#0
B#2#101
Byte#'a'
b#16#f
CHAR
'A'
CHAR#49
'Address'
W#16#0000
W#16#FFFF
word#16#f
WORD#8#177777
8#177777
W#2#1001_0100
WORD#32768
STRING
WORD
DWORD
DW#16#0000_0000
DW#16#FFFF_FFFF
Dword#8#37777777777
8#37777777777
DW#2#1111_0000_1111_0000
dword#32768
INT
-32768
+32767
INT#16#3f_ff
int#-32768
Int#2#1111_0000
inT#8#77777
DINT
-2147483648
+2147483647
DINT#16#3fff_ffff
dint#-65000
Dint#2#1111_0000
dinT#8#17777777777
REAL
Decimal format
123.4567
REAL#1
real#1.5
Exponential format
real#2e4
+1.234567E+02
S5TIME
T#0ms
TIME#2h46m30s
T#0.0s
TIME#24.855134d
TIME
-T#24d20h31m23s647ms
TIME#24d20h31m23s647ms
T#0.0s
TIME#24.855134d
Date
D#1990-01-01
DATE#2168-12-31
TOD#00:00:00
TIME_OF_DAY#23:59:59.999
DT#95-01-01-12:12:12.2
TIME_OF_DAY
Conversion
ROUND
TRUNC
FALSE
TRUE
BOOL#0
BOOL#1
DATE_AND_
TIME
Declaration Section
Constants
Labels
TemporaryvVariables
Static variables
Input parameters
Output parameters
In/out parameters
CONSTEND_CONST
LABELEND_LABEL
VAR_TEMPEND_VAR
VAREND_VAR
VAR_INPUTEND_VAR
VAR_OUTPUTEND_VAR
VAR_IN_OUTEND_VAR
plc4good.org.ua
Address Identifiers
Mnemonic
addresses
(internat.)
Qx,y
Ouptut (via the process image)
QBx
Ouptut (via the process image)
QDx
Ouptut (via the process image)
QWx
Ouptut (via the process image)
QXx.y
Ouptut (via the process image)
Dx.y
Data block
DBx
Data block
DDx
Data block
DWx
Data block
DXx.y
Data block
Ix.y
Input (via the process image)
IBx
Input (via the process image)
IDx
Input (via the process image)
IWx
Input (via the process image)
IXx.y
Input (via the process image)
Mx.y
Memory bit
MBx.y
Bit memory
MDx
Bit memory
MWx
Bit memory
MXx
Bit memory
PQBx
Output (Direct to peripherals)
PQDx
Output (Direct to peripherals)
PQWx
Output (Direct to peripherals)
PIBx
Input (Direct from peripherals)
PIDx
Input (Direct from peripherals)
PIWx
Input (Direct from peripherals)
x = number between 0 and 65535 (absolute address)
y = number between 0 and 7 (bit number)
Data Type
Bit
Byte
Double word
Word
Bit
Bit
Byte
Double word
Word
Bit
Bit
Byte
Double word
Word
Bit
Bit
Byte
Double word
Word
Bit
Byte
Double word
Word
Byte
Double word
Word
Operations
Assignment Operation:
:=
Arithmetic Operations:
**
+
*
/
MOD
DIV
+
Comparison Operations:
<
>
<=
>=
=
<>
Logical Operations:
NOT
AND or &
XOR
OR
Parentheses :
()
Symbol
Precedence
Assignment
11
Power
Unary plus
Unary minus
Multiplication
Division
Modulo function
Integer division
Addition
Subtraction
2
3
3
4
4
4
4
5
5
Less than
Greater than
Less than or equal
to
Greater than or
equal to
Equal to
Not equal to
6
6
Negation
And
Exclusive or
Or
3
8
9
10
Parentheses
6
6
7
7
Control Statements
IF...THENELSIFTHENELSEEND_IF
CASEOF:ELSEEND_CASE
FORTOBYDOEND_FOR
WHILEDOEND_WHILE
REPEATUNTILEND_REPEAT
CONTINUE
EXIT
Elementary Data Types
Bit Data Types
Character Types
Numeric Types
Time Types
BOOL
BYTE
WORD
DWORD
CHAR
INT
DINT
REAL
TIME
DATE
TIME_OF_DAY
S5TIME
Date elements of this type occupy either 1 bit, 8 bits, 16 bitsor 32 bits
Data elements of this type occupy exactly 1 character in the ASCII character set
Data elements of this type are available for processing numeric values.
Data elements of this type represent the various time and date values in STEP 7.
Defines an area of 64 bits (8 bytes). This data type stores date and time (as a binary coded
decimal) and is a predefined data type in S7-SCL.
Defines an area for a character string of up to 254 characters (data type CHAR).
Defines an array consisting of elements of one data type (either elementary or complex).
Defines a group of data types in any combination of types. It can be an array of
structures or a structure consisting of structures and arrays.
Parameter Types
TIMER
COUNTER
BLOCK_xx
ANY
POINTER
plc4good.org.ua