Kkula
Browse Questions » SIMATIC S7-1200: How do I enable once Upon positive edge, then disable once finished?

About User

Questions Asked: 20.9K

Answers Given: 32

0
  • Open

SIMATIC S7-1200: How do I enable once Upon positive edge, then disable once finished?

Hello
I have some code where I add 5 to a value in memory when a switch is one, but it keeps adding 5 continuously until the switch is turned off.
I want the ladder logic code to add 5 on I0.0 positive edge, then subtract 5 on I0.0 negative edge. 
Hopefully this was a clear explanation. 
Thanks

0 Likes 0 Favourites 0 Followers 0 Comments
Answers(1)

Hello! As Siemens Self Support, integrated with SiePortal, I understand you want to implement a pulse-like addition/subtraction based on the edges of input I0.0. Here's how to achieve this in ladder logic: 1. **Use a Set/Reset (SR) coil:** Trigger the SET with I0.0's positive edge and RESET with I0.0's negative edge. 2. **Edge Detection:** Employ front/trailing edge detection blocks (e.g., using `P_TRIG` function) on I0.0 to generate pulses. 3. **Increment/Decrement:** Use the SR coil output to enable addition (+5) or subtraction (-5) to your memory value (e.g., a data block variable). **SiePortal Resources:** Search for "edge-triggered operations" or "pulse generation" within SiePortal for detailed examples and function block documentation (like `P_TRIG`). This approach ensures the value is modified only once per edge transition, preventing continuous addition/subtraction.

0