IMDTouchKnowledge BaseShop main store

Troubleshooting

Why a WinCC Flexible data log trigger bit writes zero values

HMI and touchscreens Published 7 min read By IMDTouch engineering team

Short answer

A zero-filled values column in a WinCC Flexible data log proves the TXT storage ran, not that Tag_2 was acquired. Fix the Runtime interface assignment so it attaches to PLCSIM, prove that MD500 tracks a known Real value online, then drive logging from the Change value event on Tag_1 instead of High and Low limit events, calling StartLogging on 1 and StopLogging on 0.

On this page
  1. What a zero-filled values column proves
  2. Match the interface assignment to PLCSIM first
  3. Prove Tag_2 follows the simulated value
  4. Drive the log with a Change value event, not limits
  5. Worked example: one M4.0 window, two MD500 values, one TXT
  6. Verification list
  7. Questions asked

A values column pinned at zero in a WinCC Flexible data log is an acquisition failure that the file is recording faithfully. Rows in the TXT prove only that Data_log_1 ran and wrote to disk; they say nothing about what Tag_2 actually received from PLCSIM. Fix it in this order: match the Runtime interface assignment to the simulator — the PLCSIM entry, or its PROFIBUS variant for a PROFIBUS connection; prove Tag_2 follows a known Real value written to MD500; then drop the High limit and Low limit events on Tag_1 for the Change value event, calling StartLogging when the bit reads 1 and StopLogging when it reads 0. Limit events are a numeric-crossing mechanism, and a Bool that only ever sits at 0 or 1 gives them no crossing to detect.

What a zero-filled values column proves #

The logging path has five links, and the TXT file certifies only the last one. PLCSIM holds the simulated CPU memory, the interface parameter assignment routes Runtime to it, the project connection reads MD500 as a Real into Tag_2, Runtime evaluates tag events, and Data_log_1 writes whatever it acquired to the TXT file under C:\test\. Rows whose values column reads 0 prove the write stage ran; every link above it — transport, address, data type, PLC value — can still be broken.

Read the observed symptoms against that chain:

What you observe What it means Next move
Runtime display and TXT values both stay 0 The fault is upstream of storage: interface, address, type or PLC value Interface match, then the online tag test
Runtime display moves, TXT values stay 0 Acquisition works; the log assignment or the event logic is wrong Manual log start, then the trigger events
TXT values follow the online values Storage and acquisition are both healthy Confirm start and stop on the M4.0 edges
No file appears at all The path or the write operation fails Confirm the folder exists and Runtime can write to it

Match the interface assignment to PLCSIM first #

Check the transport before any archive setting, because no logging configuration repairs a connection that cannot read the simulated CPU. In the project connection, select PLCSIM in place of TCP/IP(Auto), and set the interface parameter assignment to the matching transport: a connection configured as PROFIBUS needs PLCSIM(PROFIBUS). The interface parameters themselves sit under General > Interface > Properties... > Parameters. The CPU315-2 PN/DP on this bench supports more than one communication path, so the CPU model never selects the route — the connection entry does. The pairing of a Flexible tag with a simulated S7 CPU, step by step, is laid out in Connecting a WinCC flexible 2005 Tag to STEP 7 PLCSIM.

Branch on the result. A Runtime tag display that follows a change made in PLCSIM proves the transport; a frozen display means you correct the interface assignment and the connection entry before touching the log, because a disconnected tag cannot produce a record with content.

Prove Tag_2 follows the simulated value #

Write a known nonzero Real to MD500 in PLCSIM and read Tag_2 online — an I/O field on a test screen or the Runtime online tag display both work. The archive file is not a communication test tool. The displayed value must equal the value you wrote, and it must follow a second write. If it stays at 0, check in order that the address is MD500, that the tag type is Real, and that the PLC program still holds that value at the end of the scan instead of overwriting it. If the online display will not move even then, the split between connection driver, tag definition and screen binding is worked through in Is It the Driver, the Tag or the Screen? Diagnosing HMI Values.

When the online value tracks PLCSIM, start Data_log_1 once from a direct Runtime action, change MD500 and stop the log. A record holding the nonzero value confirms the log assignment, the logging state and the storage path, which isolates every remaining fault to the Tag_1 event logic.

Drive the log with a Change value event, not limits #

The failing arrangement attaches StartLogging to Tag_1's High limit event and StopLogging to its Low limit event. Limit events belong to numeric tags: they fire when the value crosses a configured boundary — the same high-limit and low-limit violation mechanism Siemens documents for analog alarms. A Bool has exactly the states 0 and 1, so there is no boundary for those events to interpret, and the start and stop calls do not land where the bench needs them.

Use one of two designs:

  • Boolean branch: put the Change value event on Tag_1. On each transition, read the bit and call StartLogging for Data_log_1 when it reads 1, StopLogging for Data_log_1 when it reads 0 — a small project script is the usual place for that decision.
  • Integer branch: move the trigger to MW4, give it a distinct high limit and a low limit, map the high event to StartLogging and the low event to StopLogging, and drive MW4 across those limits from the PLC program.

Pick one branch, never both at those addresses, for the overlap reason the worked example shows. The Boolean branch leaves the PLC program untouched; the Integer branch needs PLC-side writes but uses limit events in the numeric role they are built for.

Worked example: one M4.0 window, two MD500 values, one TXT #

Inputs, all from the bench being repaired: Tag_1 is a Bool at M4.0, Tag_2 is a Real at MD500, Data_log_1 holds 100 data records per log in circular method across 10 logs, the output is a TXT file under C:\test\, and Runtime on the PC talks to PLCSIM over a PROFIBUS-type connection, so the interface assignment reads PLCSIM(PROFIBUS). Run the whole sequence against PLCSIM or a bench CPU, never against the CPU of a running line.

The rule: the values column of the TXT must contain exactly the Tag_2 values seen online during the window; a record with 0 there means the tag never carried the value. The log runs only between its StartLogging and StopLogging calls, and a Boolean may raise those calls only through the Change value event.

The arithmetic. Capacity: 100 records per log × 10 logs = 1000 records retained, and the 1001st record replaces the oldest. Overlap: MW4 spans bytes MB4 and MB5, and bit 0 of MB4 is M4.0, so one write of MW4 rewrites the trigger bit — which is why only one trigger branch may run at those addresses. Window: with M4.0 at 1, write 12.5 to MD500, then 13.75; return M4.0 to 0.

The result: the TXT values column reads 12.5 then 13.75, timestamped between the rising and falling edges of M4.0.

The decision: values of 12.5 and 13.75 mean the trigger design is fixed and the run is proven end to end. Rows present with 0 send diagnosis back to the interface, the address or the data type. No rows after M4.0 falls means the stop works and the test is complete. Once the run reaches its 1000-record capacity, the oldest rows disappear, so copy the TXT out first if the run matters.

Verification list #

  1. Transport: a Runtime tag display follows a value changed in PLCSIM — proven before any log setting is touched.
  2. Process value: Tag_2 online equals each Real written to MD500 and follows a second write.
  3. Manual run: StartLogging called directly, MD500 changed once, StopLogging called — the record holds the nonzero value, so the log assignment and the storage path are healthy.
  4. Rising edge: M4.0 going 0 to 1 fires the Change value event once and the log switches to logging.
  5. Archived values: the TXT values column equals the online values from the window; a file whose timestamp moves while its values stay 0 points at tag acquisition, not at disk access.
  6. Falling edge: M4.0 going 1 to 0 calls StopLogging, and further MD500 changes add no records.
  7. Capacity: the retained history ends at 1000 records, after which the circular method removes the oldest — bounded test storage, not an archive.

Questions asked

Does the PLC program call StartLogging itself?

No. StartLogging and StopLogging are functions configured inside the HMI project, on tag events or in project scripts. The PLC only changes the trigger bit; Runtime sees the change and runs the function. A CPU cannot reach into the panel's log management, so the trigger has to exist as a tag whose event the HMI evaluates, and the bit alone starts nothing.

Is the trigger handled differently in WinCC Unified?

Yes. WinCC Unified tags carry their own trigger configuration, and its logging includes an on-demand mode that logs tags regardless of value change, for example triggered at the end of a process or a shift. A Flexible project built around limit events does not carry over unchanged; reconfigure the triggers on the Unified tags themselves.

Why does the automatic TCP/IP entry fail against PLCSIM?

TCP/IP(Auto) points Runtime at the physical network adapter, and the simulated CPU answers on the simulator's own interface rather than on that adapter, so the automatic entry never reaches it. Selecting the PLCSIM entry attaches Runtime to the simulator directly; for a connection configured as PROFIBUS, the matching entry reads PLCSIM(PROFIBUS).

Keep reading

  • How-to

    Setting a PLC bit when a WinCC flexible screen is left

    On a WinCC flexible 2008 panel, set a bit like stop1200 when the operator leaves a screen by assigning the screen's departure event a bit-setting system function on the connected Boolean tag. No script is needed. Hold the request until the PLC acknowledges it, and handle shutdown, communication loss and power loss in controller logic, never in the departing screen.

    HMI and touchscreens

  • Troubleshooting

    Why WinCC flexible MPI transfer closes its waiting window

    The waiting window closes because the Loader's MPI transfer channel cannot open the CP5611; a channel that initializes, as Ethernet does here, keeps the window open. Runtime SP3 is the released service pack for 64-bit Windows 7, so the project, the installation and the user groups are cleared. The fault is the adapter's 64-bit communication driver or the access point that should bind MPI to the CP5611.

    HMI and touchscreens

  • How-to

    Why a WinCC Unified live bit needs two scheduled tasks

    A live bit pair proves the partner's code is executing, not just that the link is up: each side increments an integer counter and the partner checks it changed within a window at least twice the increment period, for example 1 s increments against a 2 s or longer evaluation. In WinCC Unified the HMI half is two time-triggered scheduled tasks, one to increment and one to evaluate.

    HMI and touchscreens

How to Make One HMI Button Read and Write Two PLC Bits