CAI_Support
Senior Member
Another suggestion would be "edge detection" mneumonic. I see frequently here discussions and inordinate complexity to detect the start or end of an event. You already have the non-blocking timers on inputs, outputs and vars, so you must be saving some state information. Perhaps some small variation to the existing code could be used for Rising or Falling edge (or simply detecting a change of state and using the logic to work out which way it is??)
tsteq IP1[E] 0 test input1 is first detected going from high to low (falling edge)
tsteq IP3[E] 1 test input 3 is first detected going from low to high (rising edge)
Thanks for your suggestion, Ross. There are total four certain I/O pins can detect edge change, but that require to have interrupt to handle them. Which means when state changing, it will interrupt then software to determine if input is accepted. That will be a slower process. Current hardware does not have them in the input. Also, we need to make sure those interrupts are not used by anything else. We will take a note of this and plan to do that in the future.
What is the purpose of this edge detection? I am sure what you wanted is something interesting. If we know the purpose, we can better assist you.