Button (impulse switch)
Couldn't load pickup availability
Description
The FB_EdgePulseGenerator function block detects rising and falling edges of an input signal (e.g., a button) and generates a defined 1-second pulse via a monostable timer (TP) when the button is pressed. Main and auxiliary contacts (NO/NC) are switched depending on the pulse state. There are clear modes for simulation, deactivation, and reset.
Note: This logic is intended as a template. It must be integrated, reviewed, and approved by qualified personnel before productive use. Improper use may lead to unexpected behavior.
How it works
Disabled
If #Enable
is not set, outputs are disabled. The timer is stopped, but the current input state is still stored for correct detection upon reactivation.
Edge detection
The block detects rising ( #risingEdge
) and falling ( #fallingEdge
) edges of the input signal #Coil_A1
by comparing it with the previous state.
Pulse generation
On a rising edge, a 1-second pulse is generated via the monostable timer #TP_Impulse
. During this pulse, certain contacts are considered active or inactive.
Contact logic
Main and auxiliary contacts are set depending on the pulse state:
-
#Klemme14 := #Klemme13 AND #TP_Impulse.Q
– NO main contact active during pulse -
#Klemme22 := #Klemme21 AND NOT #TP_Impulse.Q
– NC main contact outside pulse -
#Klemme34 := #Klemme33 AND #TP_Impulse.Q
– NO auxiliary contact during pulse -
#Klemme42 := #Klemme41 AND NOT #TP_Impulse.Q
– NC auxiliary contact outside pulse
At the end, the current input state is saved so that the next edge is correctly detected.
Technical details
-
Input signal:
#Coil_A1
(e.g. button) -
Edge detection:
#prev
,#risingEdge
,#fallingEdge
-
Timer:
#TP_Impulse
(monostable pulse: 1 second) -
Contacts: Main and auxiliary contacts NO/NC:
#Klemme13/14
,#Klemme21/22
,#Klemme33/34
,#Klemme41/42
-
Control:
#Enable
,#Reset
,#SimMode
-
Internal state:
#tog
is not used here (blink-free, pulse-oriented)
Possible applications
- Generation of defined pulses when a key is pressed or a signal changes
- Pre-testing of signal sequences in simulation mode
- Linking of main and auxiliary contacts for clear switching states
- Support in diagnosis through recognizable impulse events
Note: A complete technical inspection and approval by qualified personnel is required before productive use.
compatibility
- Siemens S7-1200 & S7-1500 controllers
- Suitable for TIA Portal with SCL support
- Integration into higher-level control processes possible
- Simulation option without real outputs for validation
Scope of delivery
You will receive:
- An SCL file with implemented function block
- Clear declaration of all inputs/outputs and timer instance
- Annotated structure for quick adaptation
- Quick guide to integration
The download link will be provided after purchase.
Support
I am happy to support you with:
- Adjusting the edge/pulse logic
- Integration into process or diagnostic chains
- Understanding impulse behavior and state interpretation
- Specific adjustments for your application
Contact is possible via shop message or email. Extensions are available as optional customizations.