meta data for this page
LamaPLC: Simatic S7 SCL commands: Bit logic operations
positive/negative edge monitoring
Of course, there is an R_TRIG / F_TRIG function for edge monitoring, but do you really need to call an FB and an IDB for such a simple function?
Both positive and negative edge monitoring require an additional BOOL-type static, DB, or mark variable (temp is not suitable) in addition to the signal variable. This variable stores the signal state from the previous cycle, which is then compared to the current state. If the old state is FALSE and the current state is TRUE, it indicates a positive edge; if the reverse is true, the old state is TRUE, and the new state is FALSE.
The example below demonstrates the two options, with the variables being FB local “static” variables, but they can also be DB variables or markers. The signal can also be an input.
edge_monitor
// signal, old_signal is type BOOL IF #signal AND NOT (#old_signal) THEN // positive flash block program // ; END_IF; IF NOT(#signal) AND #old_signal THEN // negative flash block program // ; END_IF; // update the storage BOOL #old_signal := #signal;
R_TRIG
Detect positive signal edge, if the state changes from FALSE to TRUE at CLK. I have described above a similar but much simpler procedure for edge monitoring: positive/negative edge monitoring.
_FB_ R_TRIG (CLK := signal monitoring (BOOL), Q ⇒ result (BOOL);
| parameter name | parameter type | function |
|---|---|---|
| CLK | input | Incoming signal |
| Q | output | Result of edge evaluation |
If you'd like to support the development of the site with the price of a coffee — or a few — please do so here.
F_TRIG
Detect a negative signal edge if the state transitions from TRUE to FALSE at the CLK. I have described above a similar but much simpler procedure for edge monitoring: positive/negative edge monitoring.
_FB_ F_TRIG (CLK := signal monitoring (BOOL), Q ⇒ result (BOOL);
| parameter name | parameter type | function |
|---|---|---|
| CLK | input | Incoming signal |
| Q | output | Result of edge evaluation |
Automation! - S7 index
| URL_name | Name | Description | Readiness status |
|---|---|---|---|
| automation:s7_var | Simatic Variables/Types | Variables, types, addressing, pointer | 90 % |
| automation:s7_hw | Simatic HW basic / PLC Types | HW config, SW structure | 2 % |
| automation:s7_modbus | Simatic and Modbus | Simatic S7 and Modbus communication | 1 % |
| automation:s7_scl_commands | Simatic Functions | Standard and system functions | 70 % |
| automation:s7_com | Simatic Communication | Communication | 0 % |
| automation:s7_opc | Simatic OPC UA | Using and operating OPC UA | 0 % |
| automation:s7_ard | Simatic & Arduino | Simatic & Arduino | 1 % |
| automation:s7_iot | Simatic IoT | Simatic & Internet of Things | 0 % |
This page has been accessed for: Today: 3, Until now: 77