Overview
Lesson #11 Rising and Falling Edge in Ladder Logic
In SIMATIC Manager (Siemens S7), edge detection—rising edge (positive edge) and falling edge (negative edge)—is not an inherent instruction in classic Ladder Logic but can be implemented manually using memory bits or functional blocks. Here's how it works:
🔄 What Are Rising and Falling Edges?
-
Rising edge = a transition from 0 → 1
-
Falling edge = a transition from 1 → 0
These transitions produce a single scan pulse used to trigger one-shot actions such as increment counters or toggle outputs Reddit+15tili.eu.org+15Reddit+15PLCtalk+1Siemens Support+1The Engineering Projects+1PLCtalk+1.
⚙️ Edge Detection Implementation in SIMATIC Manager
Since SIMATIC Manager (S7) Ladder doesn’t include a built-in POS (positive) or NEG (negative) instruction like TIA Portal, you typically:
-
Store the previous input state in a memory bit (M‑bit or DB tag).
-
On each scan, compare current input with stored value.
-
Generate an output pulse when the comparison detects the specific transition.
-
Update the stored memory bit with the current input value for the next scan.
Example in Ladder Logic (conceptual):
Then always:
🧠 Implementing in SCL (Structured Control Language)
These blocks can be called within your Ladder logic or any SCL program to generate edge pulses reliably
🧐 Why This Works
-
The comparison of current vs previous state lets you detect transitions (rising or falling).
-
The resulting output
Bis only TRUE for one scan cycle, effectively making it a one-shot pulse. -
This matches the behavior of an edge trigger: you act only on the change, not on steady state.
🗣 Insights from Practitioners (Reddit)
A user explains the memory bit logic clearly:
“To tell if it's a falling edge … you need a memory bit to hold the state from the last cycle. Then you run a comparison: is I615.1 low and M4.2 high? Then yes, you have a negative edge.”
Another explains that M-bits store past states to enable edge detection in SIMATIC Manager’s legacy style .
✅ Summary Table
| Edge Type | Condition | Implementation |
|---|---|---|
| Rising | Input = 1 & Last = 0 | (A = TRUE) AND (STORE = FALSE) |
| Falling | Input = 0 & Last = 1 | (A = FALSE) AND (STORE = TRUE) |
| Memory Update | Store current to last | STORE := A |
🧩 In Ladder Logic
-
Use contacts to check current and memory bit.
-
Use coil to set output one scan.
-
Always update the memory bit at end of network.
💻 In SCL
-
Encapsulate logic in Function Block (FB).
-
Use
STOREvariable for memory state. -
Call FB for each edge-detection input.
🧭 Practical Use Cases
-
Counting pulses: Trigger counter on rising edge.
-
Timers: Start a timer only once when input changes.
-
State changes: React only when inputs flip edge, not when steady.