CAI_Support said:The time stamp does not make any sense to the outside of the firmware, it is not based on second, and it is not the second from 1970, either.
CAI_Support said:There are internally 24 non-blocking timers, and twice more for the WC32. Expose them all will require add same number of IO Identifier to the symbol table, which can not add that many any more. We need to think some other way to reference them.
CAI_Support said:Hi Ross,
Are you suggest just remove non-blocking delay feature, instead of returning how long as the last state change and current state?
That is possible to do. However, if we want to keep non-blocking delay, we must treat low to high transaction differently from high to low, unless we allow user to reverse input inverse based on its logic.
For most people who only need non-blocking delay to check one direction pulse length, they don't need to change the input invert in their PLC. We think that is still simple than providing time since change and current state to let user figure out. At least it will save a variable.
CAI_Support said:Hi Ross,
Non-blocking delay are handled differently for VAR, TTL Output and TTL Input. The reason is that VAR and TTL output is simple last value and current value. TTL input could be up and down and up again.
We had logic like you said inside, however, it does not handle the FALSE state is high voltage situation. If you invert the TTL input for that IP2, then it will not handle the low to high situation. Because non-blocking delay is counting how long the TRUE is, if the time is not reached, it will return false. The net result is that smaller pulses being filtered out. However, smaller pulses for low to high has same effect as huge pulse from high to low on the same input pin. So that the logic you recommend, which is what have been shipping, does not work for both. You either treat 5V as logic 1, or treat 0V as logic 1. When you want to treat both 5V and 0V as logic 1, it conflicts.
In Tim's code, his code from low to high non-blocking delay working fine in the same PLC code. However, the section he has problem is that same IP2 needs to ignore how long it is 5V, but looking for how long it is in 0V. That is like input being inverted. This is TTL input issue, nothing to do with OP or VAR.
That is why we propose to add a command to invert input because PLC programmer know when to detect 0-to-1 pulse longer than certain time, when to detect 1-to-0 pulse longer than certain time.
tsteq ip1[1000] 1 ; is input high now, and been high for 1 second or more?
set op1 1 ; set output only after input has been high for a second
tsteq ip1[1000] 0 ; is input now low, and been low for 1 second or more?
set op1 0 ; clear output only after input has been low for a second