Function to capture the falling edge of a condition.
Syntax |
bool fall (bool cond) |
---|---|
cond |
Condition whose falling edge is to be captured |
Result |
Returns TRUE only when the condition is FALSE and was TRUE 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 fall() 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 multiple variables |
Each fall() function has its own memory of the condition state.
The evaluation of the front end 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(fall(inp(1 ))) and at step 1100 if(fall(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:
|