Overview: TP Pulse Timer and the Meaning of Elapsed Time
The TP (Pulse Timer) is an IEC 61131-3 compliant function block that emits a fixed-duration output pulse on the rising edge of its trigger input. The pulse width is governed entirely by the PT (Preset Time) parameter, not by the duration of the trigger signal. In SIMATIC S7-1200 and S7-1500 controllers, TP is one of four IEC timer primitives (TP, TON, TOF, TONR) located under Instructions › Basic Instructions › Timers in the TIA Portal task card.
TP exposes two outputs that are useful to your program:
- Q (BOOL) — pulse state. TRUE while the timer is running, FALSE otherwise.
-
ET (TIME) — elapsed time. The current internal counter, beginning at
T#0mson a rising edge of IN and increasing monotonically toward PT.
Elapsed time is the current accumulated time inside the timer. It is not a remaining time, not a status flag, and not a count of completed pulses — it is purely the running total since the last accepted rising edge of IN. Monitoring ET lets a program answer questions such as "how long has the output been high?" or "did the pulse complete?" without polling Q, and it lets an HMI display a real-time progress bar during a pulse.
TP Function Block Pinout
| Parameter | Direction | Data Type | Meaning |
|---|---|---|---|
| IN | Input | BOOL | Trigger. Rising edge starts the pulse. |
| PT | Input | TIME | Pulse duration (e.g., T#2s, T#500ms, T#1m_30s). |
| Q | Output | BOOL | TRUE while the pulse is active; FALSE otherwise. |
| ET | Output | TIME | Elapsed time since the last accepted rising edge. T#0ms on a fresh trigger, increments each scan, holds at PT when the pulse ends. |
The internal TIME data type in S7-1200/1500 is a signed 32-bit double integer representing milliseconds. The valid range is T#-24d_20h_31m_23s_648ms to T#24d_20h_31m_23s_647ms. Because ET is non-negative during a pulse, only the positive half of the range is ever observed in practice.
Timing Diagram (IN, Q, ET)
Elapse Time Behavior Step-by-Step
-
Idle state. IN is FALSE. Q is FALSE. ET is
T#0ms. -
Rising edge on IN. The TP block captures the edge, sets Q to TRUE, and starts the internal counter at
T#0ms. - Active pulse. Each OB1 cycle (or the configured time base for legacy blocks), ET increments by the elapsed interval. Q remains TRUE.
- Re-trigger attempt. Additional rising edges on IN while Q is TRUE are ignored. ET is not reset; the pulse runs to completion.
- Pulse end. When ET reaches PT, Q falls to FALSE. ET holds at the value of PT until the next rising edge of IN.
-
Next cycle. A new rising edge on IN resets ET to
T#0msand restarts the cycle.
T#0ms when Q falls. It does not — ET only resets on the next accepted rising edge of IN. If you need "pulse finished" detection without waiting for the next edge, compare ET >= PT in your application logic, or poll the falling edge of Q.Declaring a TP Instance and Tagging ET in TIA Portal
To read ET you must have a TP instance. There are two options, both supported on S7-1200 and S7-1500.
Option A — Single-Instance DB (recommended for TIA Portal V13+)
- Drag TP from the task card into a code block (OB, FB, or FC). TIA Portal auto-generates an instance DB named
IEC_Timer_0_DB(or your custom name). - Open the instance DB. The DB contains the standard IEC TP interface plus internal members
STIME,STATE, and a tag namedETof type TIME. - To make ET visible on the HMI or in a watch table, expose it as a multi-instance or assign it to a global tag:
"MyPulse_ET" := "TP_DB".ET;
Option B — Multi-instance inside a parent FB
- Create an FB (e.g.,
FB_PulseMonitor) and declare a multi-instance section:
VAR
PulseTimer : TP; // multi-instance
Elapsed : TIME;
END_VAR
2. Call the TP in the FB body and copy ET to a static tag:
PulseTimer(IN := bTrigger, PT := tPreset);
Elapsed := PulseTimer.ET;
3. Make Elapsed accessible by adding the FB to the watch table, or by reading it in a higher-level block.
Data Type Mapping for ET
| Source | Type | Display Format (HMI default) | Range |
|---|---|---|---|
| TP block output ET | TIME (DINT ms) | d _ hh:mm:ss.ms e.g. 0d_00:00:02.500 | 0 to 2 147 483 647 ms (~24d 20h) |
| Global tag mirroring ET | TIME / DINT / LREAL | Configurable per tag | Same range after conversion |
| HMI tag (WinCC / Comfort Panel) | TIME → DINT then scaled | Output as text/bar | 0 to 2 147 483 647 ms |
Programming Examples
LAD (Ladder) — TP with ET mirrored to a global tag
Network 1:
| TP_DB |
| IN := "StartBtn"|
| PT := T#2.5s |
| Q => "PulseOut"|
| ET => "PulseElapsed"|
|---------------------|
The ET => "PulseElapsed" assignment moves the running ET value into the global tag PulseElapsed of type TIME. PulseElapsed is selectable in the PLC tag table and will appear in the watch table and on HMI screens.
FBD (Function Block Diagram)
The FBD representation is identical in pinout. Use the same ET => Tag connector syntax. ET is on the lower output pin of the TP block.
SCL (Structured Control Language)
// Pulse generator with elapsed-time feedback
IF "StartBtn" AND NOT "StartBtn_Old" THEN
"TP_DB".IN := TRUE; // start on rising edge
ELSE
"TP_DB".IN := FALSE;
END_IF;
"TP_DB".PT := T#2s500ms; // 2.5 second pulse
"PulseOut" := "TP_DB".Q;
"PulseElapsedMs" := TIME_TO_DINT("TP_DB".ET); // convert to ms for HMI bar
"StartBtn_Old" := "StartBtn";
Notes on the SCL pattern:
-
TIME_TO_DINTstrips the sign and returns milliseconds as a 32-bit signed integer. This is the conventional format for HMI progress bars (range 0 to 2 147 483 647). - You can also use
DINT_TO_REALand divide by 1000.0 to get seconds as a floating-point value for trending. - If you are using a multi-instance TP inside an FB, the syntax is identical — just use the instance name (e.g.,
PulseTimer.ET) instead of the DB name.
Version Differences and Time Base
| CPU / TIA Portal | Time Base | ET Update | Notes |
|---|---|---|---|
| S7-1200 with TIA V13–V18 (IEC TP) | 1 ms (CPU cycle) | Every OB1 scan | ET is a TIME tag. Behavior is fully IEC 61131-3 compliant. |
| S7-1500 with TIA V13–V19 (IEC TP) | 1 ms (CPU cycle) | Every OB1 scan | ET is a TIME tag. S7-1500 System Manual documents the IEC TP block identically. |
| S7-300/400 (legacy "TP" block) | 10 ms base | 10 ms / 100 ms / 1 s / 10 s selectable | ET exposed as S5TIME (BCD). Not the same as the IEC TP block. |
| S7-1500 in TIA V19 with "TP_TIME" variant | 1 ns possible | 1 ns (system clock) but BCD/TIME displayed as ms | Refer to the firmware-specific help in the TIA Portal Information System for the exact block variant. |
The S7-1200 system manual and S7-1500 system manual, both available from the Siemens Industry Online Support portal, are the authoritative source for the IEC TP block signature and behavior. Always confirm the block type pulled into your project (right-click → "Block Properties" → "Information" tab) against the system manual of the firmware version installed on your CPU.
Monitoring ET in Watch Tables, Web Server, and HMI
Watch Table / Online & Diagnostics
- Open Watch and force tables from the project tree.
- Add the TP instance DB (
"TP_DB") and either expand it or add the explicit path"TP_DB".ET. - Go online and toggle the trigger. The ET column will count from
T#0mstoPT, then hold at PT until the next trigger edge.
S7-1500 Web Server
- Enable the Web server in the CPU properties (TIA V13+) and create a user with read access.
- Add
TP_DBto the variable list of the standard Web page, or create a custom Web page that pollsTP_DB.ET. - Access from a browser at
https://<CPU-IP>. ET displays in Time format.
HMI / WinCC (Comfort Panel, Unified, WinCC Professional)
- In the HMI tag table, add a tag
PulseElapsedwith PLC connection toTP_DB, memberET, data typeTIME. - For a numeric display, set the format pattern to 999 d 23:59:59.999.
- For a progress bar, convert ET to DINT ms (
TIME_TO_DINT(TP_DB.ET)) and divide by 1000 in a script or use the bar's percentage property with max set to PT (in ms).
Edge Detection: When ET Resets and When It Does Not
| Event | Effect on Q | Effect on ET |
|---|---|---|
| Rising edge on IN, idle state | Q = TRUE | ET resets to T#0ms and starts counting |
| Rising edge on IN, while Q already TRUE | No effect (ignored) | No effect — continues counting toward PT |
| IN goes FALSE while Q TRUE | No effect | No effect — continues counting |
| ET reaches PT | Q = FALSE | ET holds at PT |
| IN goes TRUE again after pulse end (Q already FALSE) | Q = TRUE | ET resets to T#0ms
|
| CPU restart (cold/warm) | Q = FALSE | ET = T#0ms (instance re-initialized) |
| CPU stop → run | Depends on instance retentivity | Same as restart unless ET is declared retentive |
Common Pitfalls and Field-Proven Caveats
-
Confusing ET with a remaining-time output. ET is elapsed. To get remaining time, compute
PT - ETin your application code. - Reading ET from the wrong block family. The legacy S7-300/400 TP uses S5TIME encoding (BCD), not TIME. Reading its ET as a TIME will return garbage on the S7-1500 IEC TP block.
- Polling ET in a slow OB. If the OB1 cycle time is 50 ms, ET updates in 50 ms steps even though the firmware internal resolution is finer. For sub-cycle resolution, use a time-driven OB (e.g., OB35 at 1 ms on S7-1500).
- Using TP where TONR is correct. TP ignores re-triggers. If you need an accumulating timer (e.g., total run-time of a motor), use the retentive on-delay timer (TONR) instead.
- Displaying negative TIME on HMI. HMI controls configured for "Signed" TIME will show a negative bar if the value falls below zero (e.g., a corrupted instance). Configure the field as unsigned or clamp the value at zero in the PLC.
- Forgetting to call TP in the cyclic OB. A TP FB inside an FC that is only called conditionally will not accumulate time. Place the call in OB1 or in a cyclic interrupt OB that is always triggered.
Troubleshooting Matrix
| Symptom | Likely Root Cause | Remedy |
|---|---|---|
ET stays at T#0ms even though Q toggles TRUE |
Wrong block type (e.g., legacy S_PULSE or a TON block) | Confirm block is TP from Basic Instructions › Timers; replace instance |
| ET counts in large steps (e.g., 50 ms jumps) | OB1 cycle time > 1 ms | Reduce OB1 cycle or move TP to a time-driven OB (OB35/OB36) |
| ET never reaches PT | Trigger remains FALSE before ET reaches PT (re-triggered from 0) — unlikely with TP; check whether TONR is being used | Verify block type is TP and not TONR; check PT value vs. trigger frequency |
| ET shows negative value on HMI | Tag type mismatch (e.g., INT vs. TIME) | Use TIME or DINT with explicit conversion; configure HMI field as unsigned |
| Q goes FALSE earlier than PT | TP is being called in multiple scan cycles incorrectly or the instance is shared with another block | Verify single-instance usage; remove duplicate TP calls |
| ET resets unexpectedly on CPU restart | Instance DB not marked retentive | Set Retain = true on the instance DB properties |
Online value shows 16#FFFFFFFF
|
Instance DB has never been initialized (compile/download order issue) | Do a full download of the program and perform a CPU restart |
| ET appears to jump forward | OB1 was held for a long time (e.g., breakpoint); timer was held, then released | Avoid breakpoints in production code; expect an ET jump after debugging |
Verification Procedure After Configuration
- Compile and download the project to the CPU. Perform a warm restart if the instance was changed.
-
Go online and add
TP_DBto a watch table. - Force IN briefly to TRUE (or pulse the physical input). Verify Q goes TRUE.
-
Observe ET counting from
T#0msto PT in the watch table. - Confirm Q falls exactly when ET reaches PT (within one OB1 cycle).
- Toggle IN repeatedly while Q is TRUE. Confirm ET does not reset and Q does not extend.
- Read the same tag from the HMI or web server to verify end-to-end visibility.
Related Siemens Documentation
- SIMATIC S7-1200 Programmable Controller System Manual — authoritative reference for the IEC TP block on S7-1200.
- SIMATIC S7-1500 Programmable Controller System Manual — authoritative reference for the IEC TP block on S7-1500.
- SIMATIC S7-1200/1500 Programming Guideline (TIA Portal) — best-practice patterns for timer usage.
- Siemens Industry Online Support — firmware release notes and KB articles indexed by CPU order number.
What is elapsed time (ET) in a Siemens TP pulse timer?
ET is the TIME-typed output of the TP function block that shows how much time has accumulated since the last accepted rising edge of the IN input. It starts at T#0ms, increments once per OB1 cycle, and saturates at the PT value when the pulse ends. ET resets to T#0ms only on the next rising edge of IN, not when Q falls.
How do I tag the ET output of TP in TIA Portal?
Open the TP instance DB (or the multi-instance inside the parent FB) and read "TP_DB".ET into a global TIME tag, for example "PulseElapsed" := "TP_DB".ET;. The global tag is then available in watch tables, the Web server, and HMI screens. For numeric displays convert with TIME_TO_DINT("TP_DB".ET) to get milliseconds as a 32-bit integer.
Why does ET stay at PT after the pulse ends instead of returning to zero?
The IEC 61131-3 specification for TP defines ET as a held value once it reaches PT. It does not automatically reset to zero when Q falls. ET is only reset on the next accepted rising edge of IN. If you need a "pulse-complete" signal, poll the falling edge of Q or compare ET >= PT in your application code.
Can TP be retriggered while the pulse is still running?
No. The IEC TP block ignores additional rising edges on IN while Q is TRUE. The pulse runs to PT regardless of further triggers. If you need a re-triggerable pulse, use a TON with manual reset, or implement a custom FB. If you need an accumulating run-time counter, use TONR.
How is the S7-300/400 legacy "TP" different from the IEC TP block in TIA Portal?
The legacy TP in STEP 7 Classic uses S5TIME (BCD-encoded) and a configurable time base (10 ms, 100 ms, 1 s, 10 s). The IEC TP block in TIA Portal uses the modern TIME (DINT ms) type and the 1 ms CPU cycle base. Do not port code that reads the S5TIME-coded ET directly into an IEC TP instance — the encoding is incompatible and the value will be wrong.