Is it possible the the Compare is working correctly because the value is changing faster than you can see in the GUI? I have seen this behavior before.
Is there any remedy for this?
If you have a 1500, there is a trend feature you can use to graph values scan by scan.
Otherwise, for just monitoring code, no. The scans are 1) way too fast for the human eye 2) would overload the comms if they needed to send ALL the data
What is the data type of the compare instruction, and what is the data type of each tag? Are you mixing signed and unsigned integers?
I've seen this on various platforms and every single time, it's a case of scan sequence. Something like
Scan Start:
Set MyVariable to 10
...
more code
...
If MyVariable < 20 Set MyFlag
...
more code
...
Set MyVariable to 30
...
End of scan
So when you look at the GUI, you see that MyVariable is 30, and MyFlag is true, because that's the state of those tags at the end of the scan. But at the instant the LES instruction is executed, the value of MyVariable is 10.
Easy check: right before the LES instruction, Move the value of MyVariable into a diagnostic tag. Then you get to see the value of MyVariable as the LES instruction sees it. I would bet a carton of my favourite Hazy IPA that you'll find it is, in fact, less than the specified comparator.
If this is the case, there is no problem. The program is working exactly as it's supposed to. It's just difficult to see it.Thanks for your input, so in such a scenario what could the solution?