Troubleshooting
Why a WinCC flexible 2008 I/O field rejects fractional timer values
Short answer
In WinCC flexible 2008 SP3 an I/O field formats a raw word; it does not convert a typed 2.5 or 0.1 into an S5Time duration, which is a time-base code plus three BCD digits. Connect the field to an integer preset in tenths of a second, encode S5Time in the PLC, and verify by reading the word back.
On this page
Your I/O field is not broken, and no other display format will repair it. In WinCC flexible 2008 SP3 the field formats and transfers a raw 16-bit word; it does not convert a typed 2.5 or 0.1 into an S5Time duration, so the controller receives a word it cannot use as a timer preset. An S5Time word is an encoded duration — a time-base code in bits 12 and 13 plus three BCD digits in bits 0 to 11 — and the conversion your WinCC Professional V12SP1 project relied on was a service of that newer runtime, not of the tag. The fix is to stop typing seconds into an S5Time tag: connect the field to an integer that holds the preset in tenths of a second, encode that integer into S5Time in the PLC, and prove the word by readback.
What an S5Time word actually holds #
S5Time is the 16-bit duration type of the S7-300 and S7-400 timers, and it is an encoding, not a number of seconds. Bits 0 to 11 hold three BCD digits — the count 000 to 999, each decimal digit in its own four bits — and bits 12 and 13 carry the time-base code, with bits 14 and 15 unused and kept at zero. The duration equals the count multiplied by the base:
| Bits | Content |
|---|---|
| 15 and 14 | unused, kept at zero |
| 13 and 12 | time base: 00 = 10 ms, 01 = 100 ms, 10 = 1 s, 11 = 10 s |
| 11 to 0 | three BCD digits, the count 000 to 999 |
The BCD detail is what defeats the decimal field: the count 25 is stored as 0010 0101, while the binary integer 25 is 0001 1001. A display format changes how a value is rendered; it neither picks a base nor converts binary digits to BCD. The type itself handles fractional presets without trouble — its finest base is 10 ms — so the limitation sits in the entry path, not in the timer type.
Why no display format in 2008 SP3 fixes it #
- Decimal places are a rendering instruction. One decimal place puts a decimal point into what is shown for the transferred word; no step in that path computes a base code or BCD digits, so what lands in the DB is not a duration.
- Switching the tag between S5Time, Time and decimal changes only how the same bits are interpreted on screen. Time is the wrong shape as well as the wrong width — it is a 32-bit milliseconds value — so a 16-bit word read as Time is misread before any scaling question arises.
- The field transfers the typed number unscaled, and the readback check below will show it as a non-duration against the table above.
So stop testing formats. The conversion has to live where you can see and test it — in the PLC program — fed by a plain integer.
Checks that isolate the fault #
Run these before changing the project; each expected result points to the next step.
- Confirm the connection. The field must point at the intended DB variable and the tag type must match the variable, because an S5Time variable and an integer at the same offset are different quantities. A mismatch here produces the same symptom.
- Monitor the destination word online while entering a value and compare it with the table above. A valid duration has zeros in bits 15 and 14, a known base code, and digits no greater than 9; anything else confirms the entry path produced a non-duration — the fault this article fixes.
- Watch the word across several scans after the write. A value that reverts to an earlier one points to a second writer: initialization logic, a recipe transfer, another station.
- Separate the two look-alike faults. An entry that stays on screen but never reaches the controller is traced in why an HMI edit box shows a value that was never set. A write that reaches the preset as zero is traced in why an HMI numeric entry writes zero to a counter preset.
- Keep preset and remaining time apart. The preset is the requested duration; the remaining value changes while the timer runs, so an editable field wired to it fights a moving number. Showing the countdown is a separate job, covered in how to display a time-until-closed countdown on an HMI.
- Check what the timer itself reads. If the DB word is right but the timer's preset input is wired to a different variable, the mapping is the fault, not the field.
The fix: an integer in tenths, encoded in the PLC #
- Add an integer variable for each adjustable duration, holding the preset as a count of tenths — the operator's value in seconds multiplied by ten.
- Connect the I/O field to that integer tag with a plain decimal format, and label it in tenths, for example 'Dwell, tenths of a second'. Set the field limits to 1 and 999, the full mantissa range of the base this scheme uses.
- Encode in the PLC: convert the integer to BCD, set bits 13 and 12 to 01 (the 100 ms base code), and load the result into the preset the timer reads. A plain move of the integer into an S5Time variable encodes nothing — the timer reads binary digits as BCD and runs the wrong duration.
- Keep one owner. Recipes, startup initialization and any other writer change the tenths variable; only the conversion logic writes the S5Time word, so the encoded word stays stable and inspectable at every scan.
- Verify every entry by readback against the encoding, as worked out next.
Worked example: 2.5 s and 0.1 s entered as 25 and 1 #
Inputs, with where each comes from:
- The two requested presets, 2.5 s and 0.1 s — the values from your application that the 2008 SP3 field would not take.
- The field unit: tenths of a second, the integer count from step 1 above.
- The base code: 01 in bits 13 and 12, the documented code for the 100 ms base, chosen because its mantissa is itself a count of tenths.
The rule in words: duration = BCD count × time base. With that base the mantissa equals the count in tenths, so the word is bits 15 and 14 at 00, bits 13 and 12 at 01, and the count in BCD in bits 11 to 0.
First preset: 2.5 s ÷ 0.1 s = 25, and 25 in BCD is 025, binary 0000 0010 0101. Assemble the word: 0001 0000 0010 0101, which is hex 1025 — 4133 if a plain integer display reads it.
Second preset: 0.1 s ÷ 0.1 s = 1, BCD 001, binary 0000 0000 0001. Assemble the word: 0001 0000 0000 0001, which is hex 1001 — 4097 as a plain integer.
Result: type 25 and the data-block word becomes hex 1025, which the programming tool renders as the corresponding timer duration; type 1 and it becomes hex 1001. Both are valid durations the timer can run.
Decision: adopt this entry path — a readback of hex 1025 after typing 25 proves it end to end. The threshold to hold: the mantissa stops at 999, so any preset that must exceed 999 tenths moves to the next base up, with the count in whole seconds and a different base code in the conversion.
Acceptance: readback, then a timed run #
Prove the first timed run with the machine in a safe state or on the bench — the preset under test sets real process timing.
- Read the encoded word online after every write, match it to the worked values above, and confirm it holds across several scans with no other writer disturbing it.
- Time the run with a controller trace or a scoped output, measuring from the initiating condition to the timed transition. The interval must equal the preset within the timer's base resolution and scan effects; the HMI screen refresh is not a timing reference.
- Run the boundary entries, 1 and 999, before copying the pattern to every adjustable timer in the project.
- Starting and stopping the timer from the HMI, and showing the value again after the run, is the pattern in PLC timer value on an HMI: start, stop and show after a win.
Questions asked
What is the largest duration S5Time can encode?
Every base takes a BCD count from 000 to 999, so the maximum is 999 with the 10 s base: 9990 s, about 2 h 46 min. The tenths scheme in this article uses a single base, so its ceiling is 999 tenths; a longer preset moves to the next base up, with the count in whole seconds and a different base code in the conversion logic.
Is there a ready-made block that converts an integer to S5Time?
The standard library call runs the other way: FC 33 converts S5Time to Time, and a result outside the TIME range is limited to that range, which suits arithmetic and display. No documented standard call takes an integer to S5Time, so encode the word in your own logic and also reject counts above 999 in the program, because recipes and other writers can bypass the field limits.
Why did the same setup work in WinCC Professional V12SP1?
Because the conversion was a service of that runtime, not a property of the tag. With an S5Time process tag and a decimal format, the newer runtime translated the typed number into an encoded duration before the write, while the 2008 SP3 runtime only renders formats. Copying the DB or re-creating the tag does not carry the behavior backward, and the PLC-side conversion works identically with either runtime.
How do I show the remaining time in seconds beside the preset?
Convert the timer's remaining value with FC 33 to Time, a milliseconds count, then scale it to seconds for display. Keep that field read-only and off the preset tag: the remaining value changes while the timer runs, so an editable field on it shows a moving number and any write to it means nothing.