IMDHMIControls LibraryShop main store

Troubleshooting

Why S7-1200 timer ET never exceeds PT in ladder logic

PLC programming Published 6 min read

Short answer

No. On the documented S7-1200 IEC timer operation, ET stops when it reaches PT, so an ET greater than PT comparison is false on every scan and a P_TRIG fed by it never fires; the gated network is unreachable. Source the edge from the timer's Q bit, or change the test to ET >= PT, and verify the tag mapping online.

On this page
  1. Can ET ever be greater than PT on an S7-1200 timer?
  2. Why does the greater-than comparison never become true?
  3. Why doesn't the P_TRIG fire when the timer finishes?
  4. What should drive the code after the timer completes?
  5. How do you confirm the comparison tags really map to ET and PT?
  6. Why might the timer not start at all?
  7. Do you delete the gated network or fix it?
  8. Questions asked

No, it cannot, and the code behind that comparison is unreachable as drawn. In the documented operation of the S7-1200 IEC timer instructions, elapsed time ET stops increasing the moment it reaches preset time PT and holds there, so a test of ET greater than PT is false on every scan of every run. A P_TRIG fed by that comparison never sees a false-to-true transition, so every network it conditions can never execute through this path. Source the edge from the timer's Q output instead — or change the comparison to ET >= PT — after confirming online that the tags really carry ET and PT.

Can ET ever be greater than PT on an S7-1200 timer? #

No. The timing diagrams in the S7-1200 documentation show elapsed time ET counting up to preset time PT and then holding there, so ET never passes PT on any scan of any run.

For a TON, a false-to-true edge at IN starts the run, ET increases while IN stays TRUE, Q goes TRUE when ET reaches PT, and ET then holds at PT for as long as IN remains TRUE. The other IEC timer instructions in the same manual collection hold ET at PT the same way. The network under review compares two tags: Current_Time, type TIME with initial value T#0ms, connected to the timer's ET output, and Max_Time, type TIME carrying the preset, T#5s in this example. The tag names are incidental; the limit comes from the timer instruction itself.

Why does the greater-than comparison never become true? #

Because ET only ever occupies values below PT or exactly PT, a strict greater-than test is false in both states: 4990 ms against 5000 ms is false one scan before expiry, and 5000 ms against 5000 ms is still false at expiry.

Worked example, preset PT = T#5s, which is 5000 ms, with IN rising at time zero:

Point in the run ET Current_Time greater than Max_Time
Mid-run, t = 1.0 s 1000 ms false
Last scan before expiry, t = 4.99 s 4990 ms false, 4990 > 5000
Expiry scan, t = 5.0 s 5000 ms false, 5000 > 5000
Held after expiry, t = 6.0 s 5000 ms false

The arithmetic never crosses: one scan out, ET is 10 ms short of the preset; at expiry the two operands are equal, and a strict greater-than excludes equality. Equality is the best this timer ever delivers, so the logic result feeding the next instruction is FALSE on every scan.

Why doesn't the P_TRIG fire when the timer finishes? #

A P_TRIG needs a false-to-true change at its input; an input that reads FALSE on every scan of the run gives it nothing to detect, so its output — and every network conditioned on that output — never executes.

The instruction compares the incoming logic result with the state saved in its memory bit and pulses its output for the one scan on which the change to TRUE is detected. Saved state and live input both stay FALSE here, so no pulse is possible. That saved-state mechanism is the same one behind rising and falling edge trigger instructions in PLC programs.

The scan table is the test that proves it, at PT = 5000 ms:

Time into the run IN ET Q Result into the P_TRIG
1.0 s TRUE 1000 ms FALSE FALSE
4.99 s TRUE 4990 ms FALSE FALSE
5.0 s TRUE 5000 ms TRUE FALSE
6.0 s TRUE 5000 ms TRUE FALSE

The only operand that changes state at expiry is Q, FALSE to TRUE at t = 5.0 s. That column is the edge source the P_TRIG needs; the comparison column is flat FALSE from the first scan onward.

What should drive the code after the timer completes? #

Use the timer's Q output: a contact on Q in front of the P_TRIG when the gated code runs once at completion, Q directly as a level while the timer is done, and >= in place of > only when the comparison itself must stay.

  • One action per completion: put the Q contact in front of the existing P_TRIG, keeping the edge instruction's own memory bit. The output pulses on the scan Q goes TRUE.
  • Continuous action while done: use Q as a plain level contact. With a TON, Q drops when IN drops, which matches the usual run-while-timed-out window.
  • Comparison has to remain because the block is reused as a plant standard: change > to >=. ET holds at PT once expired, so the test turns TRUE on the expiry scan, hands the P_TRIG exactly one rising edge, and stays TRUE until IN drops.
  • Counting completions rather than acting once: count the one-scan pulses, the way a siren pulse count sequence in S7-1200 ladder logic drives its counter from a timer-derived pulse.

How do you confirm the comparison tags really map to ET and PT? #

Watch them together in online mode through one full run: Current_Time must stop climbing at exactly Max_Time's value, and the timer's Q must change state on that same scan, the expiry scan.

  1. Open the cross-reference list for Current_Time and confirm its only write access is the timer's ET output; repeat for Max_Time and for whatever feeds PT.
  2. Go online with the block in monitor mode, take IN from FALSE to TRUE, and let the run pass expiry.
  3. Note the value where ET stops and the scan where Q changes; both tags must show the same value at that point.
  4. Keep the comparison result in view: a strict greater-than reads FALSE at every scan, including the expiry scan.
  5. If Current_Time is written anywhere else — a move instruction, an HMI write, another block — the always-false conclusion applies only to the timer's own ET, and that second write needs its own check.

If steps 1 through 4 confirm the mapping, stop looking for a timer fault: the timer is doing exactly what the documentation shows, and the condition is the defect.

Why might the timer not start at all? #

Because the IEC timer instructions start timing on a false-to-true edge of IN, an IN that is already TRUE when the controller enters RUN — or that never drops between runs — never presents that edge, so ET sits at zero and Q never comes.

A separately reported symptom belongs here: after a TIA Portal version change, a TON that never ran was fixed by changing the timer's type from IEC_TIMER to TON_TIME. Treat that as a reported fix rather than documented behavior, and retest online after making it. Editor-specific timer quirks are not unique to one platform, and the mirrored case, a TON that works in structured text but not in ladder, is worth recognizing on sight.

Do you delete the gated network or fix it? #

Fix, don't delete, while the completion action is still wanted: the network is unreachable only because its condition can never change state, so re-sourcing the edge to Q makes it live; delete it only when the action itself is obsolete.

  • Completion action wanted: add the Q contact in front of the existing P_TRIG, download, and prove one pulse per timing run in monitor mode.
  • Comparison block has to stay: change > to >= and leave the rest of the network untouched — the same single edge at expiry, with no rewiring downstream.
  • Action obsolete: remove the network and its two tags, so the next maintainer does not read an always-false test as live logic.

One caution before you download: if the gated network issues commands — starts a drive, opens a valve — prove the corrected edge with the machine in a safe state, because you are enabling code that has never executed on this installation.

Questions asked

What happens to ET and Q when IN drops on a TON?

ET clears to zero immediately and Q goes FALSE on the same scan, leaving the timer ready for the next false-to-true edge of IN. That also means Q delivers exactly one rising edge and one falling edge per IN cycle, which is what makes it a clean source for an edge-detection instruction.

How long does a P_TRIG output stay TRUE after it fires?

One scan cycle. The instruction compares its input with the state saved in its memory bit and sets the output only on the scan where the change to TRUE is detected; the saved state then catches up. When downstream logic needs a longer pulse, feed the edge into a pulse timer set to the width you need.

Does changing PT while a TOF is running shorten its delay?

No. The S7-1200 documentation states for TOF that changing PT while the timer is running has no effect on the current run, and switching IN back to TRUE while it runs resets and stops it. Set the new PT before the run starts and retest the timing online after the change.

Can two edge-detection instructions share one memory bit?

No. Each one needs its own memory bit operand, because the bit stores the previous state of that instruction's input; a shared bit is overwritten by whichever instruction executed last, so edges are lost or fire late. Assign a unique bit to every edge instruction and check the assignments in the cross-reference list.

Keep reading

  • How-to

    Build a siren pulse count sequence in S7-1200 ladder logic

    Use a positive-edge request to load a target of 3, 2, or 1 pulses, then run a four-state ladder sequence — idle, start, stop, count — that drives Q6.2 (START) and Q6.1 (STOP) from separate states so the two SIMOCODE Pro V commands never overlap. With a 2.0 s on-time and a 1.0 s gap, the three patterns finish in 11.0 s, 7.0 s, and 3.0 s.

    PLC programming

  • How-to

    Latch two level inputs for pump start and stop control

    Use one reset-dominant latch: set the pump when the low level probe reads dry and reset it when the high probe reads wet, so the pump holds its state between the probes. A rung that only compares the inputs drops out the moment water covers the low probe; the latch turns the probe spacing into hysteresis.

    PLC programming

  • Troubleshooting

    Start a PID ramp soak profile from ladder logic

    The profile never starts from ladder because the JMP stage handoff leaves the old stage on for three more scans, which swallows the one-scan PD pulse that must set the ramp/soak start bit. Replace the jump with SET and RST stage logic, then verify bit 11, the +33 octal control word and the +35 error flags before touching the PID instruction or table values.

    PLC programming