Вы находитесь на странице: 1из 2

Entering and Displaying Constants

Data Format Entry Examples and Range Limits Data Type

Numerical constant:
Binary digit TRUE or FALSE BOOL
Unsigned decimal
integers
(16 bits) B#(0,0) to B#(255,255) WORD
(32 bits) B# (0,0,0,0) to B#(255, 255,255,255) DWORD
Signed integer -32768 to +32767 INT
(16 bits)
Signed integer L# -2147483648 to L#+2147483647 DINT
(32 bits)
Hexadecimal B#16#0 to B#16#FF BYTE
W#16#0 to W#16#FFFF WORD
DW#16#0 to DW#16#FFFFFFFF DWORD
Binary 2#0 to 2#1111111111111111 WORD
2#0 to DWORD
2#11111111111111111111111111111111
REAL number
IEEE floating point positive min. positive max.
+1.175495e-38 +3.402823e+38 REAL
negative min. negative max.
-1.175495e -38 -3.402823e +38 REAL
Counter constant:
BCD counter preset C#0 to C#999 (entered as a decimal integer, stored as WORD
BCD)
Timer constant:
S5TIME value S5T#0ms and S5TIME
S5T#10ms to S5T#2h46m30s
CPU time constant:
TIME value T# -24d20h31m23s647ms to TIME
T#+24d20h31m23s647ms
or
T# -65535ms to T#+65535ms
DATE value D#1990-01-01 to D#2168-12-31 DATE
TIME_OF_DAY value TOD#00:00:00.000 to TIME_OF_DAY
TOD#23:59:59.999
DATE_AND_TIME DT#90-01-01-0:0:0 to DATE_AND_TIME
value DT#89-12-31-23:59:59.999
Character constant:
'Character' 'a' (ASCII character) CHAR
'Character String' 'Character string with a length of 2 to 254 characters, STRING
including special characters such as
$$ dollar sign, $' apostrophe,
$ L or $l line feed,
$P or $p page break,
$R or $r carriage return,
$T or $t tabulator
Pointer constant:
P# P# x.y (area-internal double word) POINTER
P#Areax.y (area-crossing double word) POINTER
P#Area x.y TYPE z ANY
Example: ANY reference: P#M50.0 BYTE 10
Area = M
x.y = 50.0
TYPE = BYTE
Number of data type units z = 10
This example defines data area MB50 to MB59.

Note
Instead of the short data type prefixes, the long representations are also possible.

Вам также может понравиться