Description
With the "Detect negative signal edge" instruction, you can detect a state change from "1" to "0" at the CLK input. The instruction compares the current value at the CLK input with the state of the previous query (edge memory bit) that is saved in the specified instance. If the instruction detects a state change at the CLK input from "1" to "0", a negative signal edge is generated at the Q output, i.e., the output has the value TRUE or "1" for exactly one cycle.
In all other cases, the signal state at the output of the instruction is "0".
|
Note Behavior after CPU startup The IEC61131 standard describes that the instruction "F_TRIG" sets the output "Q" to TRUE for one cycle if the input "CLK" has the value FALSE at CPU startup. In order for "F_TRIG" to show the behavior described in the standard after a CPU startup, the "Stat_Bit" instance must be initialized with TRUE. |
Parameters
The following table shows the parameters of the "Detect negative signal edge" instruction:
|
Parameters |
Declaration |
Data type |
Memory area |
Description |
|
|---|---|---|---|---|---|
|
S7-1200 |
S7-1500 |
||||
|
EN |
Input |
BOOL |
I, Q, M, D, L |
I, Q, M, D, L, T, C |
Enable input |
|
ENO |
Output |
BOOL |
I, Q, M, D, L |
I, Q, M, D, L |
Enable output |
|
CLK |
Input |
BOOL |
I, Q, M, D, L or constant |
I, Q, M, D, L, T, C or constant |
Incoming signal, the edge of which is to be queried. |
|
Q |
Output |
BOOL |
I, Q, M, D, L |
I, Q, M, D, L |
Result of edge evaluation |
Example
The following example shows how the instruction works:
The previous state of the tag at the CLK input is stored in the "F_TRIG_DB" tag. If a change in the signal state from "1" to "0" is detected in the "TagIn_1" and "TagIn_2" operands or in the "TagIn_3" operand, the "TagOut_Q" output has signal state "1" for one cycle.