CAI_Support
Senior Member
During SET OP8[2000] 1
If the previous state was 0, it will be set to 1, also set timer of 2000.
Then it will check every 100mS to see if that timer passed, if so, it will reset the output state.
However, in your above code, it executed many more often than 100mS, so that when the OP8 RESET to 0, it almost immediately sets OP8 to 1 again.
Please also note, when GET OP8[x] or TSTEQ OP8[x], If your PLC never called non-blocking delay on that OPy pin, it will return the pin state. If your PLC code set OPy[x], it will depend on the x value, if x value not met yet, it will return previous state, if x value met, it will return current state.
If the previous state was 0, it will be set to 1, also set timer of 2000.
Then it will check every 100mS to see if that timer passed, if so, it will reset the output state.
However, in your above code, it executed many more often than 100mS, so that when the OP8 RESET to 0, it almost immediately sets OP8 to 1 again.
Please also note, when GET OP8[x] or TSTEQ OP8[x], If your PLC never called non-blocking delay on that OPy pin, it will return the pin state. If your PLC code set OPy[x], it will depend on the x value, if x value not met yet, it will return previous state, if x value met, it will return current state.