Anda di halaman 1dari 4

Number Formats

Type of Data
Description.

Size
in
Bits

BOOL (BIT )

BYTE

WORD

16

DWORD

32

Format
Boolean

Hexadecimal

Range & Number Notation


( Lowest to Higest Value )
TRUE / FALSE

Example
TRUE

B#16#0 to B#16 #FF

L B#16#10

W#16#0 to W#16#FFFF

L W#16# 1000

DW#16#0000_0000 to

L DW#16# 10AB_FF00

DW#16#FFFF_FFFF

BYTE

WORD

16

DWORD

32

Binary

2# 0 to 2# 1111_1111

L 2#0000_1100

2# 0 to 2# 111_1111_1111_1111

L2#1111_1010_0000_1100

2# 0 to 2# 1111_1111_1111

L2#0011_1100_1111_1111

1111_1111_1111_1111_1111

WORD

16

DWORD

32

Unsigned
decimal

_1010_1100_0011_11111

B# (0,0 ) to B# ( 255,255 )

L B # ( 4 , 220 )

B# (0,0,0,0 ) to

L B# ( 255, 255,255,255 )

B#(255,255,255,255)

WORD

SIMATIC S7

16

BCD

C # 000 to C# 999

L C# 133

Training for Automation

Number Formats
Type of Data
Description.
INT ( Integer )
DINT(Double

Size
in
Bits
16
32

Format
Signed Decimal
Signed Decimal

Integer )
REAL

S5 TIME

DATE

TIME-OF-DAY

CHAR.

SIMATIC S7

Range & Number Notation


( Lowest to Higest Value )
- 32768 to 32767
L 1
L#-2147483648 to
L#21474883647

32

16

16

32

Example

IEEE

1.17549e -38 to

Floating Point

3.402823e+38

S5 Time - 10ms

S5t#0H_0M_0S_10MS to

to 9990s

S5t#2H_45M_30S_0MS

IEC date in 1-

D#1990-1-1 to

day units

D#2168 -12-31

Time of day in

TOD#0:0:0.0 to

1ms units

TOD#23:59:59.999

character

A , B and so on

L L#1

L 1. 234567e +13

L S5t#2H_45M_30S_0MS

L D#1999-3-15

L TOD# 1:10:3.3
LE

Training for Automation

Integer Number Representation


Example :

15
0

12 11
0

Sign
0=+ve
1=-ve

8 7
0

Decimal Values :

4 3
0

32

0
1

+ 8 + 4 = 44

Integer Number Representation


Example :

31

24 23

16 15

8 7

11111111 11111000 01011110 11100000


Sign

SIMATIC S7

Decimal Value
Training for Automation

REAL Number Representation in SIMATIC S7

Representation format of a REAL number (IEEE FP 32 bit binary format):


31

30

29

28

27 26

25

24

23

22

21

20 19

18

17

16

15

14

13

12

11 10

0 1 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2-23

2-1
S

Exponent: e = 8 Bit

Representation of a normalized REAL number:


S x (1.f) x 2 (e-127)

Mantissa: f (23 Bits)

S = Sign bit, (0 corresponds to +, 1 corresponds to -)


f = 23 bit Mantissa with MSB = 2-1 and LSB =2-23
e = binary integer exponent (0 < e < 255)

Example:
S =0
e = 1000 0101 = 133
f = 1010 0000... = 0.5 + 0.125

R = +1.625 x 2 (133-127) = 1.625 x 64 = 104.0

Value range of normalized REAL numbers:


- 3.402 823 x 10+38 ... -1.175 494 x 10-38, 0, 1.175 494 x 10-38 ... 3.402 823 x 10+38

SIMATIC S7

Training for Automation

Anda mungkin juga menyukai