CAI_Support
Senior Member
Sometimes, user has need to delay an action after a switch is flipped. In one recent support case, a customer wants a motor reacting to a switch connected to a TTL input, so that when switch is turned to on, the motor turns on after two seconds, then after switch is turned off, the motor will be turned off after 5 seconds.
He developed this logic:
TSTEQ IP4[5000] 0
SET OP1 0
TSTEQ IP4[2000] 1
SET OP1 1
It does turn on output after switch on for two seconds. But when switch set to off, its output immediately turned off.
The correct logic should be
TSTEQ IPINV4[5000] 1
SET OP1 0
TSTEQ IP4[2000] 1
SET OP1 1
That is because the non-blocking delay counts positive going pulse. When it goes from 1 to 0, it should use IPINVx[yyyy] to measure if the timer time out reached.
He developed this logic:
TSTEQ IP4[5000] 0
SET OP1 0
TSTEQ IP4[2000] 1
SET OP1 1
It does turn on output after switch on for two seconds. But when switch set to off, its output immediately turned off.
The correct logic should be
TSTEQ IPINV4[5000] 1
SET OP1 0
TSTEQ IP4[2000] 1
SET OP1 1
That is because the non-blocking delay counts positive going pulse. When it goes from 1 to 0, it should use IPINVx[yyyy] to measure if the timer time out reached.