CAI_Support said:Hi Ross,
Thanks for joining the discussion. With new logic,
IPx is still the same as before with current state either 1 or 0.
IPx[y] will be true if 0V->5V pulse last longer than y milliseconds otherwise false
IPINVx[y] will be true if 5V->0V pulse last longer than y milliseconds otherwise false
IPTS x y will return in x a number indicate the length of time since last state change, either direction for input y.
So you want to make IPEDGE different from AZ1324 proposed to set what edge to record, you want to read back what was last edge change and since how long ago.
For example,
IPEDGE x y z
x is input ID can be 1 to 8
y can be VAR or RAM, stores the current state 0 or 1, with that you know the previous state must be negate of y value
z can be VAR or RAM stores the time since last state change.
You have done communication over the IO line, would these added command and data type help?
IP and IPINV returning true for a pulse sound useful. However, forgive me for being pedantic (it's a programmer trait!), but 0V->5V or 5V->0V is not a "pulse".
0V->5V->0V is a high pulse. 5V->0V->5V is a low pulse. Which way are you planning ipx/ipinvx to work? As "delayed edge timers" or "pulse detectors"?
When I proposed ipedge, I suggested an operand to determine rising/falling/either. I thought AZ1324 had agreed with my suggestion at the time, but like I said, I've not been following closely like I should.
Regardless of what you settle on, as long as it is CLEARLY described and functions AS described, I'm sure we'll manage!