Chapter 2 Devices 2_ 2.2.2 Floating-point Numbers Floating-point numbers are represented by decimal points in ISPSoft. For example, the floating-point number 500 is represented as 500.0. 2.2.2.1 Single-precision Floating-point Numbers Floating-point numbers are represented by a 32-bit register. The representation adopts the IEEE754 standard, and the format shown in the following picture. b 31 b 0 Sign bit 0: Positive 1: Negative Equation: ( ) 127 ; .1 2 1 = Ч Ч − − B M B E S The single-precision floating-point numbers range between ± 2 -126 to ± 2 +128 , and correspond to the range between ± 1.1755 Ч 10 -38 to ± 3.4028 Ч 10 +38 .
The DVP-ES3 Series PLC uses two consecutive registers for a 32-bit floating-point number. Take (D1, D0) for example. D1(b15~b0) D0(b15~b0) 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 b0 b1 b2 b3 b4 b5 b6 b20 b21 b22 b23 b24 b28 b29 b30 b31 Exponent ( 8 bits) Mantissa (23bits) The position w here the d eci mal point is hid den Mantissa sign bit (0: Positive; 1: Negative) W hen b0~b31 are zeros, the content is zero. Example 1: Step 1: Convert 23 into the binary number, 23.0=10111. 23 is represented by a single-precision floating-point number. Step 2: Normalize the binary number, 10111=1.0111 Ч24 (0111 is the mantissa, and 4 is the exponent.). Step 3: Get the value of the exponent.
∵ E-B=4→E-127=4 ∴ E=131=100000112 2-7 Binary Number Decimal Number Binary Code Decimal Hexadecimal Number (BIN) (DEC) (BCD) (HEX) 1111 15 - F 10000 16 0001 0000 10 10001 17 0001 0001 11 8-bit 23-bit S Exponent Mantissa S E7 E6 E5 E1 E0 A22 A21 A20 A6 A5 A4 A3 A2 A1 A0 E