Download Print this page

Icon Process Controls ProCon DO3000-C Series Quick Start Manual page 23

Dissolved oxygen controller

Advertisement

ProCon
— DO3000-C Series
®
Dissolved Oxygen Controller
Example: Compile decimal 17.625 to binary
Step 1:
Converting 17.625 in decimal form to a floating-point number in binary form, first finding the binary representation of the
integer part
17decimal= 16 + 1 = 1×2
+ 0×2
+ 0×2
+ 0×2
+ 1×2
4
3
2
1
0
The binary representation of integer part 17 is 10001B
Then the binary representation of decimal part is obtained
0.625= 0.5 + 0.125 = 1×2
+ 0×2
+ 1×2
−1
−2
−3
The binary representation of decimal part 0.625 is 0.101B.
So the binary floating point number of 17.625 in decimal form is 10001.101B
Step 2:
Shift to find the exponent.
Move 10001.101B to the left until there is only one decimal point, resulting in 1.0001101B, and
10001.101B = 1.0001101 B× 24 . So the exponential part is 4, plus 127, it becomes 131, and its binary representation is 10000011B.
Step 3:
Calculate the tail number
After removing 1 before the decimal point of 1.0001101B, the final number is 0001101B (because before the decimal point must
be 1, so IEEE stipulates that only the decimal point behind can be recorded). For the important explanation of 23-bit mantissa,
the first (i.e. hidden bit) is not compiled. Hidden bits are bits on the left side of the separator, which are usually set to 1
and suppressed.
Step 4:
Symbol bit definition
The sign bit of positive number is 0, and the sign bit of negative number is 1, so the sign bit of 17.625 is 0.
Step 5:
Convert to floating point number
1 bit symbol + 8 bit index + 23-bit mantissa
0 10000011 00011010000000000000000B (the hexadecimal system is shown as 0 x418d0000 )
Reference code:
1. If the compiler used by the user has a library function that implements this function, the library function can be called
directly, for example, using C language, then you can directly call the C library function memcpy to obtain an integer
representation of the floating-point storage format in memory.
For example
: float floatdata; // converted floating point number void* outdata; memcpy (outdata, & floatdata, 4);
Suppose floatdata = 17.625
If it is a small-end storage mode, after executing the above statement, the data stored in the address unit outdata is 0x00.
Outdata + 1 stores data as 0x00
address unit (outdata + 2) stores data as 0x8D
address unit (outdata + 3) stores data as 0x41
If it is large-end storage mode, after executing the above statement, the data stored in outdata of address unit is 0x41
address unit (outdata + 1) stores data as 0x8D
address unit (outdata + 2) stores data as 0x00
address unit (outdata + 3) stores data as 0x00
2. If the compiler used by the user does not implement the library function of this function, the following functions can be
used to achieve this function:
23
25-0671 © Icon Process Controls Ltd.

Advertisement

loading
Need help?

Need help?

Do you have a question about the ProCon DO3000-C Series and is the answer not in the manual?