Está en la página 1de 4

Elementary Data Types in

STEP 7
Keyword Length (in bits) Constants Variables

BOOL 1 1 or 0 I 1.0
BYTE 8 B#16#A9 MB70
WORD 16 W#16#12AF MW72
DWORD 32 DW#16#ADAC1EF5 QD40
CHAR 8 'w' DBB4

S5TIME 16 S5T#5s_200ms MW30

INT 16 123 #Value


DINT 32 L#65539 MD80
REAL 32 1.2 or 34.5E-12 DBD60

TIME 32 T#2D_1H_3M_45S_12MS QD44


DATE 16 D#1993-01-20 MW32
TIME_OF_DAY 32 TOD#12:23:45.12 #Time
Integer (INT, 16-Bit Integer) Data
Type
Value range -32768 to +32767 Arithmetic
(without sign: 0 to 65535) operations: such as, + I, * I, <I, ==I

Display formats:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: + 662 BIN.: 2# 0 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0 HEX: W#16 #0 2 9 6


9
without
+2 7 sign
Sign 2 0
4 6 x 16 = 6
positive +2 1

numbers
2
+2 1 9 x 16 =144
+2 2 x 16
2
= 512
+ 662 662

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: - 662 BIN.: 2# 1 1 1 1 1 1 0 1 0 1 1 0 1 0 1 0 HEX:W#16# F D 6 A


15 without
-2 14
+2 13 sign
Sign
negative +2 12 0

+2 11 10 x 16 =10
numbers 1
6 x 16 = 96
+2 10 2
8 6
+2 +2 +2 5 13 x 16 = 3328
3 1
Representation as +2 +2 +2 3
15 x 16 = 61440
Twos complement - 662 64874
Double Integer (DINT, 32-Bit
Integer) Data Type
Value range L# -2147483648 to L#+2147483647 Operations: such as, + D, * D, <D, ==D
(without sign: 0 to 4294967295)

Display formats:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: L# +540809 BIN.: 2# 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1

Sign
positive
numbers

HEX: DW#16# 0 0 0 8 4 0 8 9
(without sign)

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: L# -540809 BIN.: 2# 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1

Sign
negative
numbers

Representation as HEX: DW#16# F F F 7 B F 7 7


Twos complement
(without sign)
REAL (Floating Point Number, 32
Bit) Data Type
Value range -3.40282310+38 to -1.17549510-38 , 0.0, +1.17549510-38 to +3.40282310+38

Operations: such as, + R, * R, <R, ==R


sin, acos, ln, exp, SQR

General format of a Real number = (Sign) (1.f) (2e-127)

Example: 0.75

Sign of
Real no. e = Exponent (8 Bit) f = Mantissa (23 Bit)

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
16 0

0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
27 26 25 24 23 22 21 20 2-1 2-2 2-3 2- 2-23
4
.....

Real no. = +1.5 * 2 126-127 = 0.75

También podría gustarte