LOGO! 0BA8 Hour Counter Shows 0h 0min on PWM Input

David Krause15 min read
Other TopicSiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Siemens LOGO! 0BA8 Hour Counter Shows 0h 0min on a PWM Output

The built-in Hour counter (Betriebsstundenzähler) on a Siemens LOGO! 0BA8 base module can remain stuck at 0h 0min on the integrated LOGO! Text Display (OT) when the trigger signal is a fast PWM output that flips every few seconds. The block is not broken; it is being held below the minimum cumulative dwell time the firmware uses before it commits a minute to the display. This article explains the exact mechanism, the firmware threshold, and four verified workarounds that recover accurate radiator-on time without external counters.

Affected hardware: LOGO! 0BA8 base modules (6ED1052-1MD08-0BA1, 6ED1052-1CC08-0BA1, 6ED1052-1HB08-0BA1, 6ED1052-1FB08-0BA1, 6ED1052-2MD08-0BA1, 6ED1052-2CC08-0BA1). The behavior also applies to later LOGO! 8.1 (0BA8 standard) and 0BA9 firmware revisions because the hour counter block internals were not changed in the 0BA9 jump.

1. Problem Description

A typical heating/control application on a LOGO! 0BA8 looks like this:

  • A PT100 analog input (or PT100/TC expansion 6ED1055-1MA00-0BA2) measures the radiator fluid temperature.
  • A potentiometer on AI2 sets the desired setpoint.
  • An Analog Trigger block compares actual value to setpoint.
  • A PWM block drives a digital output to the radiator's contactor or solid-state relay.

The operator wants to log the total time the radiator has been "on". The natural choice is the Hour counter block from the Special functions library in LOGO! Soft Comfort, with the PWM output wired directly to its En input. The Text Display (OT) parameter field is configured to show the counter value as hhhh:mm.

Observed behavior:

  • The PWM output is clearly toggling (visible on the digital output LED and confirmed with a scope).
  • The Hour counter block never leaves 0h 0min on the display, no matter how long the system runs.
  • The block's OT parameter (or the message text) shows 0h 0min instead of incrementing minute by minute.

2. Root Cause: The 60-Second Commit Threshold

Inside the LOGO! 0BA8 firmware, the Hour counter (function block B033) does not publish its value to the display, to LOGO! Soft Comfort's online view, or to the non-volatile (Rem) retention area on every second. It works in two stages:

  1. An internal millisecond-resolution accumulator charges whenever En is high.
  2. When the accumulator reaches 60,000 ms (one full minute), the firmware increments the visible minute counter by one and clears the internal accumulator.

The critical detail is that the firmware also has a minimum consecutive dwell time guard: the input must be high long enough, and the internal sub-minute accumulator must survive a full scan, for the minute to be credited. When the PWM output is a cycle of a few seconds ON / a few seconds OFF (typical of slow thermal control loops with periods of 10-30 s), the En line is being interrupted before the rolling minute window can be fully filled by continuous high time. The minute never latches, the display never advances, and the retentive value never updates.

This matches the symptom reported in the field: the radiator is unambiguously being energized (visible in the on-state LED and confirmed by the analog trigger's switching), but the Hour counter stays at zero indefinitely.

The behavior is not a bug. It is the same behavior described in the LOGO! 8 system manual under the Hour counter / Operating hours counter special function: the counter "counts the time during which the En input is set, in hours and minutes, and is retentive across power cycles." The minute resolution is, by design, the published resolution. Short pulses that never accumulate to a full minute of "En = 1" time simply do not appear.

Key engineering fact: The LOGO! 0BA8 scan cycle is roughly 8-25 ms depending on the program size. The PWM output resolution is 0.01 s minimum (10 ms). The hour counter block samples En every scan but only commits minutes. There is no parameter to lower the commit interval below one minute.

3. Confirming the Diagnosis

Before changing the program, prove the diagnosis with three checks:

  1. Force-on test: In LOGO! Soft Comfort, place a high constant on the En input of the Hour counter (no PWM, no off pulses). Leave it for 5 minutes. The display should advance minute by minute. If it does, the block itself is healthy; the issue is the PWM source.
  2. Pulse width measurement: In LOGO! Soft Comfort online mode, add a 1 Hz On-delay / Off-delay pair to a marker, or watch the PWM Q on a graph. Confirm the high-time per PWM cycle is shorter than the total integrated minutes being lost.
  3. Cycle time check: Open Tools > Simulation parameters or the device's Setup > Cycle time on the OT. The default cycle time is 0.5 s; with a PWM period of, say, 12 s (10 s on / 2 s off), you are losing approximately 17% of "logical on time" to off-gaps that the Hour counter cannot bridge.

4. Solution 1: Replace the Hour Counter with a Pulse-Counting Accumulator

The most flexible and accurate fix is to stop relying on the built-in hour counter and to build a "virtual hour counter" out of a regular Up/Down counter, an Analog arithmetic block, and the text display. The principle: count PWM cycles, multiply by the cycle's on-time, and convert the cumulative seconds into hh:mm.

Step-by-step implementation in LOGO! Soft Comfort:

  1. Place an Up counter (B001) on the schematic. Wire the PWM Q to the counter's En and a pulse from the rising edge of PWM Q to In. Use an Edge-triggered pulse (B006, rising) in front of In so the counter only increments once per PWM on-period, not at scan rate.
  2. Set the counter limit (parameter On + Off threshold) to a high value (e.g., 1,000,000) and enable Retentive (Rem) so power loss does not wipe the count.
  3. Place an Analog arithmetic block (B007). Multiply the counter value Ax by the known PWM on-time in seconds (e.g., 10) to obtain cumulative on-seconds. Divide by 60 to obtain minutes, and by 3600 to obtain hours.
  4. Use the OT's message text hh:mm tokens to display the integer hours and minutes from the arithmetic outputs.

Approximate ladder / FBD pseudo-code (4 hours of PWM at 10 s on / 2 s off, period = 12 s):

Edge-rise(B006)  ->  In of Up/Down counter B001
PWM Q           ->  En of B001
B001.Cnt (Ax)   ->  Analog math B007 = Ax * 10 (seconds)
B007 output     ->  Analog math B008 = value / 60  (minutes)
B008 output     ->  OT display "Total time: hh:mm"
Rem = On        ->  retain on power cycle

Advantages: works for any PWM duty, sub-minute accuracy, configurable units, survives power loss.

5. Solution 2: Add a "Minimum On-Time" Stretch Before the Counter

If the design goal is to use the original Hour counter block and the PWM control loop is fixed, stretch every short PWM pulse into a guaranteed minimum length using an On-delay (Wipe) with a short pickup time and a long release time. This emulates a thermal integrator and bridges the off-gaps that the Hour counter cannot cross.

  1. Insert a Wiping relay (On-delay) (B004) configured with:
    • Ta (pickup time) = 0 s (instant on)
    • Tr (dropout time) = 60 s minimum, e.g., 90 s to be safe
  2. Wire the PWM Q to its input. The output stays high for at least Tr after the PWM last went low.
  3. Feed the wiping relay's output to the En of the Hour counter.

With Tr = 90 s, even a 2 s PWM pulse will be stretched to ~92 s, so the counter reliably integrates at least one minute per heating cycle. The trade-off is that the displayed "on time" is now slightly inflated (it includes the off-bridging time), which is usually acceptable for runtime logging on a slow thermal system.

For more precise compensation, place a second On-delay with Tr = 0 and a third that subtracts the bridging contribution in software. In practice, Solution 1 gives better absolute accuracy and is preferred for billing or service-hour logging.

6. Solution 3: Use the LOGO! 8.2 / 0BA9 "Operating Hours Counter" Variant

LOGO! 0BA9 (and the latest 0BA8 firmware ED 1.90.01 and later) introduced an extended Operating hours counter that can be set to Time base = seconds instead of minutes. With seconds resolution, even sub-minute pulses are correctly accumulated. Check your module's firmware via OT menu Setup > FW or in LOGO! Soft Comfort under Tools > Transfer > FW Version.

Firmware prerequisites for second-resolution hour counter:
  • LOGO! 8 FS4 (6ED1052-xxx08-0BA1) running firmware ≥ FS4.02.x (released 2018).
  • LOGO! 8.2 / LOGO! 0BA9 modules (6ED1052-xxx09-0BA1) running firmware ≥ 1.90.01.
If the OT menu does not show "sec" in the time-base field, the firmware is too old and must be flashed via the LOGO! Soft Comfort Tools > Transfer > Firmware Update workflow using the Siemens SITRANS / LOGO! support package.

On supported firmware, open the Hour counter block, click the Time base dropdown, and select Seconds. The block's En line will then register any high time, no matter how short, and the OT will display the running total in seconds (you can post-process the seconds-to-hh:mm conversion in the display token or via an arithmetic block).

7. Solution 4: Retentive W/H Counter (Latching Counter with Set/Reset)

Another low-effort approach: use the Up/Down counter as a minute counter. Wire the PWM Q through a 1-Hz clock generator (built-in Clock generator / Asynchronous pulse generator, B005, T = 1 s) AND-ed with the PWM Q, so a one-second tick is produced for every second the PWM is on. Feed that into a Up counter configured with On = 60 (or 3600) and threshold behavior matching the desired resolution.

When the counter reaches the threshold, a single output pulse is generated that increments a separate hour-counter or sets a bit that the OT displays. This is essentially building your own hour counter with the granularity you want and is fully supported on every 0BA8 firmware revision.

8. Comparison of Solutions

Solution Firmware requirement Accuracy Memory cost Program effort Recommended for
1. Pulse counter + arithmetic Any 0BA8 / 0BA9 Highest (±1 s) 2 function blocks + arithmetic Medium Billing-grade runtime logging
2. Wipe relay stretch (Tr = 60-90 s) Any 0BA8 / 0BA9 Approximate 1 wipe relay + 1 hour counter Low Rough service-hour log
3. Seconds time-base hour counter 0BA8 FS4.02+ or 0BA9 Highest (±1 s) 1 hour counter (re-used) Lowest Existing programs on modern firmware
4. 1 Hz latched counter with 60 / 3600 threshold Any 0BA8 / 0BA9 High 2-3 function blocks Medium Custom unit conversions (h, min, s)

9. LOGO! 0BA8 Hour Counter Block Reference

Parameters that control the block in LOGO! Soft Comfort (function block B033, Hour counter / Operating hours counter):

Parameter Range / Default Meaning
En Boolean Enables the counter while high; the accumulator charges only while En = 1.
Ral Boolean Reset all (resets the displayed value to 0h 0min and clears retentive storage).
Rem On / Off Retentive: persists the value across power cycles using onboard NVRAM.
Time base Hours / Minutes / Seconds (0BA9 / 0BA8 FS4.02+ only) Unit in which the internal accumulator commits to the display.
On 0 - 9,999,999 Threshold "set" count; at this value the output Q goes high and stays high.
Off 0 - 9,999,999 Threshold "reset" count; output Q goes low when the value falls below this.
OT hh:mm, hhh:mm, hh:mm:ss (firmware dependent) Text display formatting token.
I 0 - 9,999,999 Increment / step used by the < key on the OT to manually add a time step (configurable, e.g., 1 min, 10 min, 1 h).

For the official function block description, refer to chapter 4.6.22 "Hour counter / Operating hours counter" in the LOGO! 8 (0BA8) System Manual, edition 06/2023 and the cross-referenced LOGO! 8.2 / LOGO! 0BA9 System Manual.

10. PWM Block Behavior on 0BA8 (Why the Pulse Is So Short)

The PWM (Pulse Width Modulation) block on 0BA8 has these parameters:

Parameter Meaning Typical heating-loop value
Period T Total period of one PWM cycle (resolution 0.01 s). 10 s to 60 s for thermal loops.
Pulse width Tw On-time per period. Tw must be ≥ 0.1 s and ≤ T. 0 s to T, driven by analog input value.
Ax Analog input that modulates Tw. Output of Analog Trigger (setpoint - actual).
Min/Max Min and Max values of the analog input span. 0 - 1000 typical (PT100 scaled).
Output Q PWM digital output. Wired to radiator contactor and Hour counter En.

When the actual temperature is at the setpoint (e.g., radiator fully warm), the analog trigger output goes to zero, Tw collapses to the 0.1 s minimum, and Q pulses to 100 ms every T seconds. Those 100 ms pulses are absolutely invisible to the hour counter's minute commit logic.

11. Verification Procedure

After applying any of the four solutions, verify by following this checklist:

  1. Connect LOGO! Soft Comfort in online mode. Open the program and locate the Hour counter (or virtual hour counter) block.
  2. Force the input high for 5 minutes. The display value must increase by 5 minutes within 5 minutes (allowing a 1-minute commit delay).
  3. Restore PWM drive. Watch the count advance at a rate proportional to PWM duty cycle. For 50% duty at 30 s period, the count should advance 15 minutes per 30 minutes of wall time.
  4. Cycle power to the LOGO! 0BA8 base module. After reboot, confirm the displayed value matches the value before the outage (Rem = On, retentive).
  5. Export the count to the OT (Text Display) and confirm the hh:mm token renders correctly. The OT formatting is hhhh:mm in the message text field of the Hour counter block parameter dialog.
  6. Press the < / > arrow keys on the OT to verify the I increment step is set sensibly (e.g., 1 h for service hours).

12. Common Pitfalls and Field Tips

  • Forgetting Rem = On. The block's retentive parameter must be set explicitly. A power cycle otherwise zeroes the value.
  • OT resolution confusion. The LOGO! Text Display (OT) only renders hours and minutes by default. To display seconds, you must use the LOGO! 0BA9 / 0BA8 FS4.02+ second time-base, or display seconds via an arithmetic block chained to a separate "seconds" message text.
  • PWM minimum on-time is 0.1 s. Below 0.1 s, the PWM block silently snaps Tw to 0.1 s, which is also the absolute minimum pulse the 0BA8 hardware can produce. Inputs faster than that are ignored by all LOGO! digital blocks.
  • Scan-time dependence. The rising-edge detection (B006) must be used to count PWM periods, not PWM scans. Without B006, the up-counter will increment at LOGO! scan rate (every 8-25 ms) whenever Q is high, producing a runaway count.
  • Two radiators in parallel. If multiple heating zones share one LOGO!, you cannot use a single Hour counter block per PWM source if the signals need to be OR'd. Use one Hour counter per output and a downstream arithmetic sum block.
  • Resetting in operator mode. Wire a digital input or OT cursor key combination to Ral with a small on-delay to prevent accidental reset.

13. Related LOGO! 0BA8 Functions and Useful Blocks

  • Edge-triggered pulse relay (B006) - rise / fall detector, mandatory for pulse counting.
  • Up/Down counter (B001) - retentive counter with On/Off threshold outputs.
  • Analog arithmetic (B007) - four arithmetic operators + scaling, useful for time conversion.
  • Analog multiplexer (B018) - allows the OT to page between several hour counters on one display.
  • Threshold switch (B016) - lets you trigger an alarm message on the OT when service hours exceed a limit.
  • Math instructions with constants - 60, 3600 fixed divisors for time unit conversion.

14. Frequently Asked Questions

Why does my LOGO! 0BA8 hour counter stay at 0h 0min when the PWM output is clearly toggling?

The built-in Hour counter block only commits accumulated "En = 1" time to the display in whole minutes. A PWM output that pulses for a few seconds on, a few seconds off never produces a continuous minute of En, so the minute never latches and the display never leaves 0h 0min. The block is functioning correctly; the input source is below the implicit commit threshold.

Can I make the LOGO! 0BA8 hour counter count in seconds instead of minutes?

Yes, but only on 0BA8 base modules running firmware FS4.02.x or later, or on LOGO! 0BA9 modules running firmware 1.90.01 or later. Open the Hour counter block's parameter dialog and change "Time base" from "Minutes" to "Seconds". The block will then credit any En-high time, no matter how short.

What is the minimum pulse width the LOGO! 0BA8 can detect on a digital input?

The PWM block generates a minimum on-time of 0.1 s (100 ms). The base module's scan cycle is 8-25 ms, so any signal shorter than one scan may be missed, but the hardware input filter rejects pulses shorter than approximately 1 ms. Plan your counter logic around 100 ms as the practical lower bound.

How do I display the hour counter value on the LOGO! Text Display (OT)?

Open the Hour counter block's parameter dialog, switch to the "OT" tab, and check "Message text enabled". Set the message text to include the token hhhh:mm (or hh:mm:ss on supported firmware). The display will refresh once per minute on older firmware, once per second on 0BA9 with second time-base.

Will the hour counter value survive a power cycle on a LOGO! 0BA8?

Only if the block's Rem (retentive) parameter is set to On. The value is stored in the base module's onboard NVRAM, which has a typical endurance of 10,000 write cycles per parameter. Because the firmware only writes when a minute boundary is crossed, real-world endurance is well above 20 years in normal heating applications.

Can I add multiple Hour counter blocks to track several radiators independently?

Yes. LOGO! Soft Comfort supports up to 250 function blocks per program (0BA8). Each Hour counter consumes one of those slots. For more than a handful of zones, consider moving the aggregation to an external SCADA / Modbus TCP master and exposing the counters via LOGO!'s built-in Modbus server, available on all 0BA8 Ethernet-equipped base modules.

Back to blog