Reading LOGO! 8 RTC from VM Memory: Limits and Workarounds

David Krause15 min read
PLC HardwareSiemensTechnical Reference
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

Overview

The Siemens LOGO! 8 logic module includes a hardware real-time clock (RTC) backed by a supercapacitor or battery, depending on the variant. The clock is used internally by time-based function blocks such as the weekly timer, annual time switch, astronomical clock, and stopwatch. Despite the RTC being a built-in feature, the LOGO! programming environment exposes only a subset of the variable memory (VM) map to user logic. The byte range that contains the live RTC registers is outside the user-accessible window, which means a program running on the LOGO! 8 cannot directly read or write the current date and time the way it can read any other tag.

This restriction is documented in the LOGO! 8 system manual under the variable memory section. According to the LOGO! 8 (LOGO! 8.FS4 and later) system manual, only the address range from VB0 to VB850 is accessible from within a LOGO! program. All bytes above that boundary are reserved for internal use and for external communication partners.

LOGO! 8 VM Memory Map

The variable memory of a LOGO! 8 BM is partitioned into several functional regions. Understanding the partition is essential for diagnosing why a tag read or write fails silently in the user program.

Address Range Owner User Program Access External (Modbus / S7) Access
VB0 - VB850 User program Read / Write Read / Write
VB851 - VB923 Remanence markers, parameter VM mapping (function block parameter buffer) Read / Write (only via Parameter VM Mapping) Read / Write
VB924 - VB974 Function block I/O flags and program identifiers Read only Read / Write (with restrictions)
VB975 - VB984 LOGO! BM diagnostic and identifier area None from program Read / Write
VB985 - VB987 RTC date / time (year, month, day, hour, minute, second, weekday) None (restricted) Read / Write
VB988 - VB990 RTC control, daylight saving, status None (restricted) Read / Write
VB991+ Reserved / future expansion None Read / Write
Important: The exact upper bound of user-accessible memory depends on the LOGO! firmware version. LOGO! 8 base modules (6ED1052-xxx08-0BA1, FS1-FS3) expose VB0-VB850. LOGO! 8.FS4 (6ED1052-xxx08-0BA2) and the LOGO! 8.3 (6ED1052-xxx08-0BA3) variants expanded the user area to VB0-VB923 while keeping the RTC block in the same physical byte range. Always confirm the FS level of the BM on the device label (printed on the side of the module) before relying on a specific VM range.

RTC Byte Layout in the LOGO! 8

The RTC inside the LOGO! 8 base module is not exposed to the user program as a structured tag. Instead, the firmware maintains six to eight bytes of BCD-encoded time-of-day information in the upper VM region. The exact layout per the LOGO! 8 system manual is:

Address Byte Content (BCD) Encoding Range
VB985 Year (low byte) YY 00-99
VB986 Month / Day MM, DD nibble-packed 01-12 / 01-31
VB987 Hour / Minute / Second HH, MM, SS nibble-packed across bytes in newer firmware 00-23 / 00-59 / 00-59
VB988 Weekday / DST status 1=Mon .. 7=Sun, bit7 DST 1-7, 0/1

The encoding is binary-coded decimal (BCD) on most firmware versions, although some later LOGO! 8.3 firmware revisions moved to a binary-packed representation. If you attempt to read these values from an external Modbus master using function code 0x03 (holding register) at the documented offset, the values are returned as 16-bit Modbus registers grouped two bytes per register, so 40049 corresponds to VW985, 40050 to VW987, and so on. Refer to the LOGO! 8 communication manual for the precise Modbus register map of your firmware version.

Why the LOGO! Program Cannot Read the RTC Directly

LOGO! Soft Comfort and the LOGO! BM firmware deliberately hide the upper VM region from the FBD/LAD editor. The available blocks in the toolbox do not include any block whose input pin can be wired to VW985, VW986, or VW987. The VM address picker in the editor stops at VW850 for normal tags. Even when a tag is forced into the editor through Parameter VM Mapping, the value is treated as a read-only snapshot that the firmware overwrites each scan with the current time-of-day register.

This restriction is the root cause of the symptom commonly seen by integrators who attempt to read the current date from within a program: a network input wired to VW985 either appears blank in the simulation, returns zero, or shows a value that is immediately overwritten by the next RTC update. The analog network input (NAI) block, which is the conventional way to bring an external value into a LOGO! program, only supports offsets in the user-accessible range, so the RTC bytes are unreachable through it.

Design implication: The annual time switch, weekly timer, and astronomical clock are the only sanctioned ways to consume RTC data from the LOGO! program. If a program needs to compare the current date against an arbitrary stored date, it must do so by configuring one of these timers, not by reading the VM bytes directly.

The Year Timer / Annual Time Switch and Parameter VM Mapping Conflict

The annual time switch (also called the year timer) is a function block that evaluates a configurable on/off window against the current date. Its inputs are usually wired from a calendar editor dialog inside LOGO! Soft Comfort. Each annual time switch has an internal parameter buffer that the firmware mirrors into VM for the purpose of letting a remote device (HMI, S7-1200, Modbus master) read or change the on/off window at runtime.

Two restrictions apply to this mechanism:

  1. The mapping is one-way from the block into VM during the scan. After the LOGO! updates the year timer outputs, the firmware re-writes the mapped VM words with the time switch's parameter buffer. Any value the user program or an external write deposited at that address gets clobbered before it can be read back.
  2. It is not legal to use the same VM word as a parameter mapping target for one block and as a normal user tag for another block. The user-program write to that word is blocked as soon as the mapping is enabled, and the block then owns the word exclusively.

The result is that a user cannot mirror the RTC into the user area by writing from a remote device, because the year timer is already cyclically overwriting the mapping target. The simulation environment mirrors the same behavior, so a program that appears correct in the editor will still fail to read the RTC at runtime.

Workaround 1: Remanent Off-Delay Timer

The simplest method is to time the inactivity window with an off-delay timer that is retriggered (reset) every time the valve closes. The on-delay is set to the inactivity window — for example, 96 hours for a four-day flush reminder.

  1. Insert an off-delay block.
  2. Set the delay (Ta) to 96:00:00 (96 h 00 min 00 s). The maximum settable time on a LOGO! 8 off-delay is 99:59:59, so 96 hours fits.
  3. Wire the valve's "closed" contact to the off-delay input so that the timer is started every time the valve closes.
  4. Enable Remanence on the off-delay's elapsed-time output (Ta = retentive). With remanence on, the elapsed portion of the delay is stored across power cycles.
  5. Wire the timer's output to a message text or a logic block that forces the user to flush the system before any further use.

Verification of remanence behavior: Per the LOGO! 8 system manual, remanence on a timer stores the current elapsed value into the retentive memory area at power-off. On power-up, the timer resumes counting from the stored value. Remanence must be set explicitly; the default is non-retentive, which means the timer resets to zero on every power cycle. If the user does not check the remanence box, the four-day window restarts at zero on every power-up, and the flush reminder will never fire if the panel loses power during a long idle period.

Remanence capacity warning: The LOGO! 8 base module provides a fixed remanence budget. Each block that has remanence enabled consumes bytes from this budget. The total is logged in LOGO! > Tools > Determine Remanence inside LOGO! Soft Comfort. Exceeding the budget for the chosen BM (for example, 6ED1052-1MD08-0BA1 with limited bytes) prevents the project from being transferred to the module.

Workaround 2: Remanent Up/Down Counter with Pulse Generator

An alternative that survives a power cycle without depending on the off-delay block is an asynchronous pulse generator feeding a retentive up/down counter. The counter value represents the elapsed seconds since the last valve action; when the value exceeds 96 * 3600 = 345600 counts, the output triggers.

  1. Insert an asynchronous pulse generator. Configure the pulse width to 0.5 s and the pause width to 0.5 s, giving a one-second period.
  2. Insert an up/down counter. Set the upper threshold to a value higher than 345600, for example 400000, to give headroom.
  3. Wire the pulse generator output to the up-count input of the counter.
  4. Wire the valve's "closed" or "opened" event to the reset input of the counter so the count returns to zero on every actuation.
  5. Enable Remanence on the counter value so the count persists across power cycles.
  6. Use a threshold comparator block to compare the counter value to 345600. When the counter is greater than the threshold, the comparator output drives the flush reminder.

This pattern has the advantage of decoupling the time accumulator from the off-delay block, which has a hard maximum of 99:59:59. With a counter the limit is the LOGO! 8 32-bit counter range, which is 0 - 2147483647 counts, equivalent to roughly 68 years of one-second pulses.

Caveat: The counter is still volatile to a power loss — "the counter value will not be increased without supply." If the BM is unpowered for any period, the count does not advance during that time. The counter resumes from the value stored in remanence. For a four-day flush reminder, the implication is that a long power outage simply delays the reminder by an amount equal to the outage, which is generally acceptable for a hygiene-flush application.

Workaround 3: External Read via Modbus or S7 Communication

External devices can read and write the RTC bytes directly because the LOGO! BM exposes the full VM area on its Modbus TCP server (and on the S7 connection for LOGO! 8 with Ethernet). The relevant Modbus register map is documented in the LOGO! 8 communication manual.

Modbus Register VM Address Function FC
40049 / 40050 VW985 / VW987 RTC date (BCD) 0x03 / 0x06 / 0x10
40051 VW989 RTC time (BCD) 0x03 / 0x06 / 0x10
40052 VW991 Day of week / DST 0x03 / 0x06 / 0x10

To read the current date and time from a supervisory controller, follow these steps:

  1. Configure the LOGO! BM's IP address in LOGO! > Network on the device display, or via LOGO! Soft Comfort's Tools > Ethernet Connections.
  2. From the external Modbus master, open a TCP connection to port 502 on the LOGO!'s IP.
  3. Issue a read-holding-registers request (function code 0x03) with starting address 48 (zero-based) and quantity 4. This returns the four words starting at VW985.
  4. Decode the response as BCD. For example, a value of 0x2107 in register 40049 means the year is 21 and the month is 07 (July 2021).

A SIMATIC HMI panel, an S7-1200, or a third-party Modbus master can all be used. The data is also available over the S7 put/get protocol on LOGO! 8 modules with Ethernet. Refer to the LOGO! 8 system manual section "Communication via S7" for the connection configuration.

Modbus read-only from program: Even though the upper VM is read/write to a Modbus master, the LOGO! program still cannot read the values. A Modbus write followed by a program read will fail because the program cannot address those bytes in the first place.

Workaround 4: Compare Using Annual Time Switch in Cascaded Form

If the actual application requires a "time since last event" comparison, the annual time switch is the only block that has visibility into the calendar inside the LOGO! program. A 44-block cascade (31 days, 12 months, one leap year) is the brute-force way to implement a date compare with annual time switches, but it is not the only way.

  1. Configure a single annual time switch with an on window of one second. Use the on pulse as a one-shot once per year at the start of the testing window.
  2. Drive an up counter from that pulse; the counter is reset by the valve event.
  3. Use the counter's value to drive a message text that shows the number of days since the last actuation, with a comparator triggering the flush reminder above 4 days.

This pattern has the same power-cycle limitation as the up/down counter, but it has the advantage of being understandable by service technicians reading the FBD.

Commissioning and Verification Procedure

Regardless of which workaround is selected, the following verification steps should be run before the panel is released to production.

  1. Transfer the program to the LOGO! BM and observe the online state in LOGO! Soft Comfort.
  2. Force the valve output closed and verify the off-delay (or counter) starts counting up.
  3. Open and close the valve several times to confirm the counter is reset on every actuation.
  4. Power-cycle the BM with the valve idle and confirm the remanent timer/counter resumes from its stored value, not from zero.
  5. Set the system clock on the LOGO! to a date four days after the last actuation and verify the flush reminder message is displayed.
  6. From a Modbus master (a PC running a Modbus test tool, or an S7-1200 PUT/GET), poll 40049 to 40052 and confirm the date advances in real time.
  7. From the same external tool, write a new date to 40049 and verify that the annual time switch on the LOGO! evaluates the new date on its next scan.

Troubleshooting Matrix

Symptom Likely Cause Corrective Action
NAI block wired to VW985 shows 0 or blank Address outside user-accessible range Move NAI to VW0-VW850 or use an external read
Year timer always shows the original on/off window after Modbus write Firmware overwrites mapping target each scan Accept that VM mapping is firmware-owned; do not try to write to it
Off-delay resets to zero on every power-up Remanence not enabled on Ta Check the Remanence box in the block properties
Counter never reaches the 4-day threshold Pulse generator period longer than 1 s, or counter reset by a stray event Verify pulse period in simulation; trace the reset input
LOGO! rejects the program with "Remanence memory exceeded" Too many retentive blocks Run Tools > Determine Remanence and reduce retentive blocks or upgrade BM
Modbus read of 40049 returns an unexpected value BCD vs binary encoding mismatch Confirm firmware version; decode as BCD for FS1-FS3, binary for some 8.3 variants
External write to RTC does not stick LOGO! has just rebooted and overwritten the value Issue the write after a small delay following boot; refer to communication manual for the RTC write acknowledge

Application Example: 96-Hour Water-Valve Flush Reminder

The original problem statement is a 96-hour inactivity reminder for a water valve. The recommended implementation, given the VM-access restrictions documented above, is the off-delay approach with remanence. The block wiring is shown below.

[Valve Closed] --> [Off-Delay Ta=96:00:00, Remanence=ON] --> [Flush Reminder Output]
                                                |
                                                +--> [Message Text: "Flush system before use"]

To make the message text more useful, the elapsed time can be shown by adding a second off-delay with Ta = 24:00:00 and four cascaded counters or by using the message text's ability to display the timer's current value. The flush reminder message is displayed on the LOGO!'s onboard display, on a connected LOGO! TDE, or on a remote HMI panel that polls the LOGO!'s VM area for the message-trigger bit.

Notes on Firmware Compatibility

The behaviors described in this article are confirmed against LOGO! 8 base modules on firmware FS1 through FS4 and the LOGO! 8.3 generation. The VM layout above VB850 changed between generations:

  • FS1 / FS2 / FS3 (6ED1052-xxx08-0BA1): User area 0-850, RTC at 985-987 in BCD.
  • FS4 (6ED1052-xxx08-0BA2): User area 0-923, RTC at 985-987 in BCD, additional parameter VM region between 851 and 923.
  • LOGO! 8.3 (6ED1052-xxx08-0BA3): User area 0-923, RTC remains at 985-987 but encoding may be binary in some sub-revisions; refer to the firmware release notes shipped with the module.

Before writing any external code that depends on the RTC byte layout, identify the exact FS level of the target BM and read the matching section of the LOGO! 8 system manual. The manual is the only authoritative source for the address map and the encoding of the time-of-day registers.

FAQ

Can a LOGO! 8 program read the current date and time from the RTC directly?

No. The RTC is stored in VM bytes VB985-VB987, which are outside the user-accessible range of VW0-VW850 (or VW0-VW923 on FS4 and later). The LOGO! programming environment does not expose any block input that can be wired to those addresses, and the analog network input block cannot read them either.

Why does my year timer overwrite values I write to a mapped VM word?

Parameter VM Mapping is a one-way write from the block into the VM region. After the LOGO! evaluates the year timer each scan, the firmware re-writes the mapped VM words with the timer's parameter buffer. Any external write to that address is overwritten before the next program read. This is by design, not a bug.

How do I keep a four-day timer running through a power cycle?

Enable Remanence on the off-delay block's Ta output (or on the up/down counter value). The LOGO! 8 stores the current elapsed count in retentive memory at power-off and resumes from that value at power-up. Always run Tools > Determine Remanence after enabling to confirm the BM has enough retentive memory for the block.

Can a Modbus master read the LOGO! 8 RTC?

Yes. The LOGO! 8 Modbus TCP server exposes the full VM map. Holding registers 40049 to 40052 (zero-based address 48) cover the RTC date, time, weekday, and DST status. Refer to the LOGO! 8 communication manual for the exact register map of your firmware version, since the encoding is BCD on most firmware revisions.

What is the maximum value for an off-delay in LOGO! 8?

The off-delay block supports a maximum Ta of 99:59:59 (99 h 59 min 59 s). For longer windows such as multi-day inactivity reminders, use a retentive up/down counter driven by an asynchronous pulse generator instead, and use a threshold comparator to evaluate the count.

Back to blog