Edge
(Engine-Level Function)
| Description: | Performs a test for a rising or falling edge. |
| Returns: | Boolean |
Usage: ![]() |
Steady State only. |
| Function Groups: | Generic Math, Variable |
| Related to: | Change |
Format: ![]() |
Edge(Value, Mode) |
| Parameters: |
| Value |
| Required. Any expression giving a numeric status value to be tested. It is interpreted as true if it is non-zero, and false if it is zero. |
| Mode |
|
Required. Dictates whether the change from false to true or true to false is tested. If it is 0, a true to false (a falling edge) is tested. If it is 1, a false to true (a rising edge) is tested. |
| Comments: | Edge is one of the Latching and Resetting functions. Use accordingly. |
Example 1: Monitor for a value reaching a setpoint.
If Edge(Var1 > 2, 1) RisingState;
Jump to RisingState when Var1 changes from less than 2 to greater than 2.
If Edge(Var1 > 2, 0) FallingState;
Jump to FallingState when Var1 changes from greater than 2 to less than 2.
Example 2: Monitor for a left mouse click release
If Edge(LocSwitch() == 4, 0) {Left mouse button released } &&
Target(10, 25, 110, 225) {Mouse in target area };
[
...
]
When the operator releases the left mouse button within a target area, do what is in the script block.
