Bit Toggles on Client Update

I am using a tag to monitor the hour of the day for calculations. For example, at 11:53 PM the hour of the day is 23. I run a script when the hour changes to perform some calculations and storage of data. At the end of the script, I set a bit for the PLC to reset a counter. The problem I am having is that it seems that the script must be running when I make an update on the clients or the bit is toggling because I see the PLC counter reset to 0 even though it is not the beginning of the hour. Is there a way to suppress the run of the script or the bit toggle during an update of the Client?

If you are using a tag change event script try adding this to your if statement,

if currentValue.value == 23 and not initialChange:  
  your script

I appreciate your help! I should have known that. I've seen it before in the documentation, but haven't had an obvious need until now. I think it has solved the issue.

1 Like