I have created a Vijeo Citect 2015 project with code to mimic a momentary pushbutton. The code sets a Start bit with the mouse button is clicked (down). When the mouse button is released (up) the code waits a few seconds the sets the Start bit to zero. Here is the code:
Down command
Start = 1
Up comamnd
Sleep(5);
Start = 0
There are several uses of this code in my project, each one setting a resetting a different Start bit.
Sometimes the the Start bit does not reset. It gets "stuck" at '1'. My initial code had the up command wait two seconds before resetting the bit and with the shorter delay a few of these Start bits would get "stuck". The only remedy was to reset the bit via the PLC programming software.
I thought perhaps the PLC scan was not seeing the command to reset the bit so I increased the delay to five seconds as shown above. I am not sure the actual scan time of PLC but increasing the delay would not impact the process so I gave it a try. Almost all the Start bits now seem to be resetting but one bit still gets "stuck".
I have verified that there is no difference in the construct (code, etc.) of this one object that is still getting "stuck".
Thoughts, suggestions?
Down command
Start = 1
Up comamnd
Sleep(5);
Start = 0
There are several uses of this code in my project, each one setting a resetting a different Start bit.
Sometimes the the Start bit does not reset. It gets "stuck" at '1'. My initial code had the up command wait two seconds before resetting the bit and with the shorter delay a few of these Start bits would get "stuck". The only remedy was to reset the bit via the PLC programming software.
I thought perhaps the PLC scan was not seeing the command to reset the bit so I increased the delay to five seconds as shown above. I am not sure the actual scan time of PLC but increasing the delay would not impact the process so I gave it a try. Almost all the Start bits now seem to be resetting but one bit still gets "stuck".
I have verified that there is no difference in the construct (code, etc.) of this one object that is still getting "stuck".
Thoughts, suggestions?