IR10Edge
I = Input
R = Reading functions
The IR10Edge function detects the rising edge or falling is a digital signal.
IMPLEMENTATION
IR10Edge (Input, Type, Time, Init, Result)
Parameters:
IN/OUT | VARIABLE TYPE | EXAMPLE NAME | DIM | |
---|---|---|---|---|
IN | INPUT GLOBAL | Input | F | Digital status to be analyzed |
IN | CONST | Type | F | Front type to be analyzed, 0 for descent, 1 to rise. |
IN | CONST | Time | L | Time signal verification. With zero value the time to check is disabled. |
IN | GLOBAL | Init | F | Flag to inform if is the first execution of the function (0 for first time, 1 for subsequent) |
OUT | GLOBAL | Result | F | Flag set to 1 when it encounters the front, otherwise it is left unchanged. |
Example
In the example the “ofUscita” output is activated on the rising edge of the input “Input” after a check of 1 second.
gfInit = 0 MAIN:
IR10Edge ( Input, 1, 1000, gfInit, gfResult)
IF gfResult gfResult = 0 SETOUT ofUscita ENDIF gfInit = 1 WAIT 1 JUMP MAIN END
Note
-
In order to be effective, the function should be placed at a point of the application that runs on every logical round.
-
The result flag is set to 1 only if the front condition it occurs, otherwise it remains unchanged.
-
The Init flag this is useful if the unit was reactivated with TRESTART command and allows to initialize the function.