Explainer
Why WinCC cannot see an S5Time timer setpoint in a PCS 7 block
Short answer
A variable declared as S5Time rejects the S7_m_c attribute, so the compiler reports that the attribute is not permitted and generates no WinCC tag. Declare the operator setpoint as a plain DINT or REAL duration instead: convert it to TIME and pass it through FC40 for S_ODT, or accumulate a REAL elapsed time against an S7_sampletime input so an edited setpoint takes effect.

On this page
- Why the compiler rejects the S5Time setpoint
- Two designs that put an operator duration in the timer
- Path 1: a numeric setpoint converted with FC40
- Path 2: an APL-style sample-time accumulator
- Converting a 30-second faceplate entry to S5TIME for S_ODT
- When an edited setpoint should act on a running timer
- Which design to use
- Questions asked
The tag is missing because of the data type, not because a compile step failed or the faceplate is wired wrong. A variable declared as S5Time cannot carry the S7_m_c attribute, so the SCL compiler rejects the declaration and generates no WinCC tag for it. Recompiling will never change that outcome. Declare the operator-facing duration as a plain DINT or REAL instead and keep the S5Time value internal to the block. From there, two designs work: scale the numeric entry to milliseconds, convert it with FC40 from the IEC library, and connect the result to S_ODT.TV; or accumulate a REAL elapsed time against an input carrying S7_sampletime, the way APL-style blocks time durations, which also lets an edited setpoint act without waiting for the next start edge. Both paths, their arithmetic and their limits follow.
Why the compiler rejects the S5Time setpoint #
The block times with a classic SIMATIC timer and passes the operator value to its TV input:
UP_Timer := S_ODT(
T_NO := UpTMR_No,
S := NOT UpCount_Done,
TV := UpTMR_SP,
R := UpCount_Done,
Q := UpTMR_Done,
BI := Time_REM);
UpTMR_SP is declared as S5Time, the type S_ODT expects at TV. Turning it into an operator-settable tag would require the machine-visible attribute on the declaration:
UpTMR_SP {S7_m_c:='true'} : S5Time;
The compiler answers with 'The attribute is not permitted for the variable UpTMR_SP' and generates no tag. S7_m_c is what tells the compile step to create an operator-visible, operator-changeable tag in the WinCC tag list, so a variable that cannot carry it never enters that list. The faceplate has nothing to bind to, and every recompile ends the same way.
The rejection sits in the type itself. S5Time is a packed duration built for the timer instruction: Siemens documents it as a value stored in BCD, the product of a count in the range 0 to 999 and a time basis. A packed BCD timer word is not a numeric the OS layer addresses as a setpoint, which is why the attribute list excludes it. The failure is specific to this type system and not to the I/O field; the different case where a WinCC flexible I/O field rejects fractional timer values is covered in Why a WinCC flexible 2008 I/O field rejects fractional timer values.
Two designs that put an operator duration in the timer #
Both designs give the faceplate a numeric variable that accepts S7_m_c and keep S5Time out of the tag list. They differ in what an edit does during a run and in how much duration the path can hold.
| Design | Operator variable | Conversion | Timer element | Edited value acts |
|---|---|---|---|---|
| Numeric entry into S_ODT | DINT seconds, carries S7_m_c | scale to milliseconds, then FC40 to S5TIME | S_ODT at its TV input | at the next start edge |
| Sample-time accumulator | REAL seconds, carries S7_m_c | none | REAL elapsed value compared with the setpoint | at the next cycle comparison |
Path 1: a numeric setpoint converted with FC40 #
- Declare the operator entry as a numeric duration that accepts the attribute, for example
UpTMR_SP_sec {S7_m_c:='true'} : DINT;— the unit is seconds, and the faceplate must state it. - Scale the entry to milliseconds as TIME:
UpTMR_ms := UpTMR_SP_sec * 1000;, with UpTMR_ms of type TIME, which counts milliseconds. - Pass that TIME value through FC40 from the IEC library; FC40's output is the equivalent S5Time value. Store it in an internal variable such as
UpTMR_s5t : S5Time, declared without any attribute. - Connect that internal variable to the timer in place of the old one:
UP_Timer := S_ODT(
T_NO := UpTMR_No,
S := NOT UpCount_Done,
TV := UpTMR_s5t,
R := UpCount_Done,
Q := UpTMR_Done,
BI := Time_REM);
The unit convention is yours to define — seconds, minutes or hours — as long as the faceplate states it and the scaling matches. The hard limit is the S5TIME range: a count of at most 999 on a time basis of at most 10 s gives a maximum duration of 9990 s, which is 2 h 46 min 30 s. Cap the faceplate entry at 9990 s on this path, because a larger duration has no S5Time representation at all. This path keeps the classic SIMATIC timer alive inside PCS 7; entering S5TIME presets from the HMI side in TIA Portal projects is a different tool story, covered in Enter S5TIME timer presets from an HMI in TIA Portal.
Path 2: an APL-style sample-time accumulator #
Declare three things in the block: a VAR_INPUT of type REAL carrying the S7_sampletime attribute, a static REAL for the elapsed value, and the operator setpoint as a REAL in seconds carrying S7_m_c. During CFC compilation the compiler writes the block's cycle time into the sample-time input — on a block cycling at 100 ms that is 0.1 s. The timing logic adds the sample-time input to the elapsed value once per call while the run condition holds, compares against the setpoint, and clears the elapsed value when the run condition drops:
IF run_cond THEN
elapsed_time := elapsed_time + sample_time;
IF elapsed_time >= time_setpoint THEN
timer_done := TRUE;
END_IF;
ELSE
elapsed_time := 0.0;
timer_done := FALSE;
END_IF;
The names run_cond, elapsed_time, sample_time, time_setpoint and timer_done are illustrative; keep your block's own names. This keeps the HMI setpoint in a directly usable numeric form: no conversion, no S5Time variable anywhere in the interface, and an edited setpoint joins the comparison at the very next cycle. Resolution is one cycle time, because the elapsed value moves in steps of the sample-time input. PCS 7 libraries such as the APL build their time behavior on exactly this arithmetic rather than on SIMATIC timer instructions, so the structure matches the faceplate objects already in use. One commissioning check belongs here: after compiling the chart, confirm the sample-time input actually holds the cycle time, because a zero there leaves the elapsed value frozen.
Converting a 30-second faceplate entry to S5TIME for S_ODT #
The inputs, with their sources:
- Operator entry: 30 seconds, entered as a DINT on the faceplate — the setpoint value in this block's case.
- Scaling factor: 1000 ms per second, the definition of the millisecond.
- Converter: FC40 from the IEC library, TIME to S5Time.
- Destination: the TV input of S_ODT, which expects S5Time.
The rule in words: multiply the seconds entry by 1000 to obtain the TIME value in milliseconds, pass that TIME value to FC40, and connect FC40's S5Time result to TV.
The arithmetic: 30 s × 1000 ms/s = 30 000 ms, so the TIME value is 30000, which is T#30s. FC40 returns the S5Time equivalent — stored, per the documented format, as a BCD count times a time basis, here a count of 30 on the 1-second basis or 300 on the 100-millisecond basis.
Result: the internal variable holds T#30s, and S_ODT runs that duration from its next start edge.
Decision: the entry sits inside the S5TIME range of 0 to 9990 s, so the conversion succeeds and the value goes straight to TV. Any faceplate entry above 9990 s has no S5Time form; cap the entry at that limit or move such durations to the accumulator path.
When an edited setpoint should act on a running timer #
The reported behavior on the S_ODT path: the operator changed the setpoint while a run was in progress, the faceplate value updated, and the active run still finished on the preset in force at its start edge. That is how the timer works — it reads the duration at TV when the start edge arrives, and nothing during the run re-reads it.
The decision follows from what the operator needs. If an edit only has to govern the next start, keep S_ODT with the FC40 conversion and let each start edge pick up the current value. If the edit must shorten or extend the run in progress, use the sample-time accumulator, whose comparison reads the live setpoint every cycle — no restart required.
Which design to use #
- Operator edits only need to govern the next start, and durations stay within the S5TIME range: numeric DINT setpoint in seconds, scaled to TIME, converted with FC40, connected to S_ODT.TV.
- An edit must act on the active run, durations exceed the S5TIME range, or the faceplate works in REAL seconds: the sample-time accumulator with S7_sampletime.
- In both designs the S5Time variable stays internal and untagged: S7_m_c belongs on the numeric setpoint, never on the S5Time declaration.
- If operator entries must survive a controller restart, retention is its own configuration task — see How to Keep HMI-Entered Timer Presets in PLC Memory.
Questions asked
Why does recompiling the block not make the tag appear?
Recompiling cannot help because the export step never runs for that variable. The compiler rejects the S7_m_c attribute on an S5Time declaration before any tag is generated, so every compile ends with the same error and no entry in the tag list. The data type itself is the blocker; only a variable type that accepts the attribute can produce a WinCC tag.
Can the operator enter minutes or hours instead of seconds?
Yes, as long as the faceplate states the unit and the scaling matches it. Seconds multiply by 1000 to reach milliseconds, minutes multiply by 60000, and hours multiply by 3600000. Keep the entry at or below a 9990-second equivalent on the FC40 path, because a larger duration has no S5Time representation.
Why does a timer run ignore a setpoint edited mid-run?
S_ODT reads its duration at the TV input when the start edge arrives, so the active run keeps the preset in force at that moment and the edited value waits for the next start. To shorten or extend a run in progress, switch to the sample-time accumulator, or stop and restart the timer so a fresh start edge picks up the edit.
What does the S7_sampletime attribute do at compile time?
It marks a block input so the CFC compiler writes the block's configured cycle time into it during compilation, for example 0.1 seconds on a block cycling at 100 milliseconds. The block logic then adds that input to an elapsed value once per call, so the accumulator tracks real elapsed time without a SIMATIC timer instruction.


