IMDTouchKnowledge BaseShop main store

Troubleshooting

Why WinCC Unified CSV access needs an existing directory

HMI and touchscreens Published 5 min read By IMDTouch engineering team

Short answer

On a WinCC Unified Comfort or Basic panel, the USB device in the X61 port mounts under /media/simatic/X61, and WriteFile and ReadFile require every folder in the target path to already exist — create it on the stick or with CreateDirectory before the first write. When the file contents prove correct but the expected read/write success message never appears, the transfer has succeeded and only the feedback path is faulty.

On this page
  1. The mount path and the folder rule
  2. What the FileSystem object will and will not do
  3. File access is not CSV interpretation
  4. One round trip proves the path
  5. A missing success message is not a failed transfer
  6. The decision for each case
  7. Questions asked

When a WinCC Unified script writes or reads a CSV file on a Comfort or Basic panel, the USB device in the X61 port is addressed under /media/simatic/X61, and every folder named in the target path must already exist when WriteFile or ReadFile runs. The runtime's FileSystem object creates and writes files, but a write aimed into a folder that is not on the stick is a directory problem before it is ever a CSV problem. Put that folder on the USB device in advance, or let the script create it with CreateDirectory ahead of the first write. And when the file turns out correct while the expected read/write success message never appears, the transfer has already succeeded — the notification path is the only fault left.

The mount path and the folder rule #

A mount path is where a runtime exposes a storage device inside its file system. For the X61 interface of a Unified Comfort or Basic panel, that location is /media/simatic/X61. This is the panels' device path, not a general specification for every WinCC Unified runtime platform.

Writing to a new location involves two distinct operations: creating the file, and creating the folder it sits in. The object model treats them as separate calls. A script that names a file inside a folder absent from the stick fails at the directory step, no matter how valid the intended CSV content is. So when the target is the panel's X61 stick, the path starts at that mount point, and any subfolder you add — for example one named recipes — exists before the write, either created on the stick itself or through CreateDirectory.

What the FileSystem object will and will not do #

WinCC Unified Runtime provides the FileSystem object, of type HMIFileSystem, which gives script access to the file system of the server the runtime is installed on. Its methods cover creating, writing, reading and deleting files and creating and deleting directories; ReadFile, WriteFile, AppendFile and CreateDirectory are among them. The object-model documentation for the installed runtime version gives each method's exact parameters and encoding options — take the signature from there rather than from memory.

WriteFile and AppendFile are not interchangeable: which one the script calls decides whether the file holds one current record or an accumulating history.

File access is not CSV interpretation #

Two layers sit between the variables and the stick. File access decides whether text reaches the intended file at all; serialization decides how the variable values become that text, and deserialization turns the text back into values. A successful write proves only the first layer. For the second, both sides must agree on field order, separator, record boundaries and text encoding. Where a decimal comma is in use, a comma as field separator is ambiguous, so pick a convention and hold it on both sides. Fields that may contain the separator or a line break need an agreed quoting rule; splitting on every separator without it corrupts the mapping.

One round trip proves the path #

Run this test on a bench panel or a test project with tags that cannot command equipment, because the test overwrites whatever it reads back.

  1. Create the target folder on the stick (for example recipes) and plug the stick into X61. Record the current values of the three test tags so you can restore them afterwards.
  2. Set three distinct illustrative values: parts count 125, run time 4800 s, station number 37. Distinct values expose swapped fields that identical values would conceal.
  3. Write once. The record is expected at /media/simatic/X61/recipes/example.csv. Open the file and confirm a single record holding 125, 4800 and 37 in that order.
  4. Overwrite the three tags with values that differ from the file, for example 0, 0 and 0. This step is what proves the values later came from the file and not from memory.
  5. Read back. Each tag must equal its captured value. As a quick checksum across the three fields: 125 + 4800 + 37 = 4962 before the write, and the same 4962 after the readback. Any other total means a field was lost, doubled or misparsed.
  6. Delete the folder from the stick and repeat the write. No new file may appear. That negative run confirms the directory is the condition under test; restore the folder and the same write works again.

A missing success message is not a failed transfer #

A read/write success message is a separate application action from the file call itself, and one can work while the other is broken. When the round trip above passes and the message still never shows, stop touching the path and the CSV layout: the file result is the evidence, and it says the transfer is done. Check where the notification executes — it must run after the confirmed completion of the operation, not merely after the call was initiated — and check that it is bound to the right event and reaches the intended screen. The same split between a command and its feedback comes up when you are binding an HMI button command to a separate feedback color. If the message ever reports success while no file exists, believe the file system, not the message.

The decision for each case #

  • The target is the X61 stick on a Comfort or Basic panel: address it under the mount point, and make every subfolder exist — on the stick or through CreateDirectory — before the first write.
  • No file appears at the destination: it is the path or the missing folder. Fix that first; leave the CSV format alone until a file lands.
  • The file exists but holds unexpected or growing text: the script is appending or the layout is wrong. Choose the write mode the application actually needs and align the reader with it.
  • The text is right but the restored variables are wrong: field order, separator or type conversion is off. Correct the mapping on both sides.
  • The round trip passes and no success message appears: the transfer is complete. Repair the notification's placement and binding; leave the working path exactly as it is.

Questions asked

Does the X61 mount path also apply to a WinCC Unified PC runtime?

No. That mount path is how the Unified Comfort and Basic panels expose a USB device in the X61 port. A PC runtime runs the same FileSystem object against the file system of the computer it is installed on, so the path has to be valid on that machine, and any folder named in it must exist there before the first write.

Can the script create the missing folder itself?

Yes. CreateDirectory is one of the directory methods of the same FileSystem object. Call it ahead of the first WriteFile and the folder exists from then on. Remember that it lives on the USB device: a different stick plugged into the same port needs the folder created again before the write succeeds.

Why does my CSV file gain a record on every write?

Because the record is being appended. AppendFile adds each new record to what the file already holds, so a file written every cycle keeps growing. Decide by whether you want that history: keep appending and make the reader take the last record, or use WriteFile for a single current record and confirm in the object-model documentation that its behavior matches, because the two calls are not interchangeable.

Keep reading

  • How-to

    Configuring data logging on a TP700 Comfort panel

    Insert a FAT32 USB stick or SD card before runtime starts, define the log under Historical data with a cyclic or event trigger and a storage path on that medium, and set entries per segment and segment count so one medium covers your longest run. Stop logging, save, close all logs and use the panel's safe-removal function before pulling the stick, or the CSV corrupts.

    HMI and touchscreens

  • Troubleshooting

    Reading a USB datalog from an HMI in the CODESYS runtime

    Yes, when the panel's CODESYS runtime exposes the USB storage to the application. Prove it in three steps: confirm the HMI writes the datalog to the drive, confirm the runtime mounts the drive and read its assigned path, then open a known test file with the documented file library before reading the datalog. A failure at one step says nothing about the next.

    HMI and touchscreens

  • How-to

    Setting the USB Path for a PanelView Plus Datalog Model

    Type \External Storage 1\Logs as the Datalog Model path — the terminal's name for the first USB flash drive — instead of the default C:\Logs, then turn on data logging under Terminal Settings > Startup. The path string is case-sensitive, and the terminal enumerates only one USB flash drive at a time.

    HMI and touchscreens

Why EasyBuilder Pro Embedded Windows Need Indexed Scrolling