EasyManua.ls Logo

Allen-Bradley Micro800

Allen-Bradley Micro800
652 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Compare instructions Chapter 10
Rockwell Automation Publication 2080-RM001D-EN-E - February 2015 261
Example: Comparing Real Values using Subtraction (-) ABS, and Less than
(<)
The Real data type is not recommended when comparing values for equality
because of differences in the way numbers are rounded. Two output values may
appear equal in a Connected Components Workbench display, but will evaluate as
false.
For example, 23.500001 compared to 23.499999 will both display as 23.5 in the
variable input display, but will not be equal in the controller.
To test whether two Real data type values are equal, you can use a Subtraction
instruction to get the difference between the values and then determine if the
difference is Less Than an established precision value. See the following LD
program example for comparing two Real data type values.
Equal (=) operator ST language example
Example
(* ST Equivalence: *)
aresult := (10 = 25); (* aresult is FALSE *)
mresult := ('ab' = 'ab'); (* mresult is TRUE *)

Table of Contents

Other manuals for Allen-Bradley Micro800

Related product manuals