REDGE
Typing REDGE evaluates the rising edge of a complete Boolean expression.
TIP:
The IEC 61131-3 standard does not include the REDGE
operator.
REDGE Operator | |
---|---|
Name | REDGE |
Syntax | <edge> := REDGE ( <boo_expression>,<memo_variable> ); |
Operands | First operand is any Boolean variable or complex expression Second operand is an internal Boolean variable used to store the last state of the expression |
Return value | TRUE when the expression changes from FALSE to TRUE FALSE for all other cases |
TIP:
Trigger edges for an expression with a variable other
than the memory Boolean variable that stores the last state of the expression.
When the expression is a Boolean variable, declare a unique internal variable with same
name and the EDGE_ prefix for use in the REDGE expressions for the variable. This internal
variable prevents other REDGE operations from overwriting the memory variable.
Example
(* ST program using REDGE operator *) (* this program counts the rising edges of a Boolean input *) (* Bi120 is an input Boolean variable *) (* Edge_Bi120 is the memory of the Bi120 variable state *) If REDGE (Bi120, Edge_Bi120) Then Counter := Counter + 1; End_if;
Provide Feedback