The number values available as real numbers from the process are too imprecise for the "Compare real numbers for equality" operation. This number format is not recommended for the comparison for "equality" because of the rounding-off error of the real numbers.
The floating-point numbers (or real numbers) are represented as single-precision 32-bit numbers and access is made to them in the double-word format. In the S7-200 the real numbers are precise up to 6 decimal places.
When calculating with real numbers that need a long series of values including large and small numbers, imprecise results might occur. When viewing the real numbers in the status there might be different binary representations of the same real number.
We therefore recommend not to use the "LDR=" function , but to run the comparison using the two functions "LDR<=" and "LDR>=". This gives you a comparison framework for the value to be compared.
The STEP 7 Micro/WIN library as archive file
Copy the "real_compare" file into a separate directory and then start the file with a double-click. The STEP 7 Micro/WIN library is then unpacked. You can then integrate the library, which can be used in version V184.108.40.206 and higher of STEP 7 Micro/WIN, into your S7-200 project.
- Information about inserting libraries in STEP 7 Micro/WIN is available in Entry ID: 16689345.
real_compare ( 64 KB )