3. Instruction Set

Binary Floating Point

DVP-PLC represents floating point value in 32 bits, following the IEEE754 standard:

 

8-bit

23-bit

 

mantissa

S

exponent

b31

 

b0

Sign bit

0:positive

1:negative

Equation (−1)S ⋅ 2EB ⋅1.M ; B = 127

Therefore, the range of 32-bit floating point value is from ±2-126to ±2+128, i.e. from ±1.1755×10-38to ±3.4028×10+38.

Example 1: Represent “23” in 32-bit floating point value

Step 1: Convert “23” into a binary value: 23.0 = 10111

Step 2: Normalize the binary value: 10111 = 1.0111 × 24, in which 0111 is mantissa and 4 is

exponent.

Step 3: Obtain the exponent: E – B = 4 E – 127 = 4 E = 131 = 100000112

Step 4: Combine the sign bit, exponent and mantissa into a floating point

0 10000011 011100000000000000000002 = 41B8000016

Example 2: Represent “-23.0” in 32-bit floating point value

The steps required are the same as those in Example 1 and only differs in modifying the sign bit into “1”.

1 10000011 011100000000000000000002=C1B8000016

DVP-PLC uses registers of 2 continuous No. to store a 32-bit floating point value. For example, we use registers (D1, D0) for storing a binary floating point value as below:

 

 

 

 

 

 

 

 

 

D1(b15~b0)

 

 

 

 

 

 

 

 

 

 

D0(b15~b0)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

27

26

25

21

20

2-1

2-2

2-3

 

 

2-17

2-18 2-19 2-20 2 -21 2 -22 2-23

 

S

 

E7

 

E6

E5

E1

E0

A22

A21

A20

 

A6

A5

A4

A3

A2

A1

A0

b31

b30

b29

b28

b24

b23

b22

b21

b20

 

b6

b5

b4

b3

b2

b1

b0

 

 

 

 

 

 

8 bits of exponent

 

 

 

 

 

 

 

 

 

 

23 bits of mantissa

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Hidden decimal point

Sign bit (0: positive 1: negative)

When b0~b31 is 0, the content is 0.

Decimal Floating Point

Since the binary floating point value is not very user-friendly, we can convert it into a decimal floating point value for use. However, please note that the floating point operation in DVP-PLC is still operated in binary floating point format.

3 - 2 1

Page 137
Image 137
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Binary Floating Point, Example 1 Represent 23 in 32-bit floating point value