![]() |
![]() |
|
![]() |
||
Ladder Logic Masked comparison for Equal Instruction |
MEQ - Masked comparison for EqualTest portion of two values to see whether they are equal. Compares 16 bit data of a source address to 16 bit data at a reference address through a mask. ExampleLets say we have four counters. Each counter goes from 0 to 9. Since 0 to 9 can be represented in 4 bits then we can combine the four counters in one word of 16 bits. This is to reduce the amount of memory counters will need.
Now that we have all four counters in one word we want to compare our result to a certain value. MEQ is the solution for such a problem. MEQ will make a comparison of a value based on the bits specified in the mask section. Ladder Logic SolutionComparing N7:0 = -31166 with 2 is energizing B3:0/0 why? Well cause:
![]() Comparing N7:0 = -31166 with 64 is energizing B3:0/1 why? Well cause:
![]() Comparing N7:0 = -31166 with 1536 is energizing B3:0/2 why? Well cause:
![]() Comparing N7:0 = -31166 with -32768 is energizing B3:0/3 why? Well cause:
![]() Note
|
|