Function to capture the rising edge of a condition.
Syntax |
bool rise (cond) |
---|---|
cond |
Condition whose rising front is to be caught |
Result |
Returns TRUE only when the condition is verified and was FALSE at the previous execution |
Validity |
Rule, Task |
Note |
The first time it is executed, the function returns FALSE and stores the current state of the condition. In case rise() is used in a user R3 function, it should be avoided that the parameters of the function itself are involved in the condition expression. The result would not be as hoped because of the overlap in memory of the state of several variables |
Each rise() function has its own memory of the condition state.
The evaluation of the front is done between the current state of the condition and the memory related to the individual function call (e.g., if we have at step 1000 if(rise(inp(1 ))) and at step 1100 if(rise(inp(1))), although they refer to the same condition, the evaluation is done separately, each according to the state stored by executing step 1000 and then step 1100).
Example of use:
|