Logging LOGO! 8 Pulse Generator TH/TL Parameters in Data Log

David Krause14 min read
HMI ProgrammingSiemensTutorial / How-to
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

Logging LOGO! 8 Pulse Generator TH/TL Parameters in the Data Log

The Siemens LOGO! 8 modular logic relay is positioned as a low-cost alternative to a full PLC, but it borrows several conventions from the S7 world, including on-board data logging. Engineers using the Pulse Generator block (B006) with configurable high time (TH) and low time (TL) parameters often want those timing values captured into the data log alongside the output transitions. The default LOGO!Soft Comfort V8 Data Log configuration does not allow block parameter values such as TH and TL to be selected directly, because the Data Log block only exposes process values (digital inputs, outputs, flags, analog values, and the on-board variable memory VM). This tutorial explains the limitation in detail and documents the edge-detection workaround used by experienced LOGO! programmers to derive equivalent timing data from each pulse, without external measurement instruments.

1. Hardware and Software Prerequisites

Before proceeding, verify the operating environment matches the supported configuration.

Item Specification
LOGO! base module LOGO! 230RCE, order number 6ED1052-1FB00-0BA8 (LOGO! 8.FS4)
Power supply 115 V AC / 230 V AC, 6 A relay outputs, 4 digital inputs (no analog)
Programming software LOGO!Soft Comfort V8.0 minimum (V8.4 or later recommended)
Firmware on BM FS:04 or higher to match LOGO!Soft Comfort V8.4 project archive
Optional storage Siemens LOGO! SD card (6ED1056-1BA00-0AA0) up to 8 GB, FAT16/32
Optional interface Ethernet (Web server) or LOGO! TD for live data inspection

Reference the Siemens LOGO! product page for the complete 8.FS4 module catalog (BM, AM2, DM8, TDE, CMR, CSM). Update LOGO!Soft Comfort from the Siemens Industry Online Support portal to ensure block library compatibility with the firmware on the BM.

The 6ED1052-1FB00-0BA8 is the LOGO! 230RCEo (relay outputs, no analog inputs) variant. The article also applies to the 24RCE, 12/24RCEo, and 24CE variants because the Data Log block, Pulse Generator block, and edge-triggered logic blocks are firmware features present in every LOGO! 8 module.

2. How the LOGO! Data Log Block Works

The Data Log block is found under the "Special" function group in LOGO!Soft Comfort. It records the value of one or more signals every time the trigger condition is met or on a cyclic interval. Each record is written as a CSV-style line into the BM's internal flash or onto the optional SD card.

Records available for selection are limited to the following categories:

  • Digital and analog inputs (I1...I24, AI1...AI8 depending on expansion)
  • Digital and analog outputs (Q1...Q16, AQ1...AQ8)
  • Flags (M1...M27, AM1...AM6)
  • Variable memory (VW0...VW850 analog word, VB0...VB1024 byte, VD0...VD248 double word)
  • Cursor keys, shift register bits, and function block-specific output values

Block parameter values - for example the TH and TL time bases of the Pulse Generator - are not exposed as selectable items. The reason is architectural: parameters are stored inside the function block's instance data and are not mapped to VM memory or to the I/O image. They cannot be browsed, addressed, or logged directly from the Data Log configuration dialog.

2.1 Data Log Operating Modes

Two trigger modes are supported:

  • Edge-triggered (rising): A record is written each time a configurable enable input transitions from 0 to 1.
  • Time-triggered: A record is written every N seconds/minutes/hours, independent of any signal change.

The maximum number of records per session is constrained by the available memory. Without an SD card the BM holds roughly 16 384 records; with an SD card the limit is effectively the card's free space. Files are named /log00001.csv, /log00002.csv and rotated daily when the SD card is present.

3. Pulse Generator Block Parameters TH and TL

The asynchronous Pulse Generator (B006) generates a continuous square wave on its output. TH defines the high-time pulse width and TL defines the low-time pulse width. Both are entered in the base time unit defined by the block's time base parameter (10 ms, 100 ms, 1 s, or 1 min).

Parameter Meaning Range (depends on time base)
TH High time / mark-to-space pulse length 0.05 s to 99:59 h
TL Low time / space-to-mark pulse length 0.05 s to 99:59 h
Time base Resolution of TH and TL 10 ms / 100 ms / 1 s / 1 min
Retentivity Persists across power cycle On / Off

In the original application the user is manually editing TH and TL on the LOGO! TD or the Web server parameter page before running the program. Each new value pair should ideally be captured in the data log so that the resulting CSV proves which timing produced which output transition.

4. Why Direct Parameter Logging Is Not Possible

Three architectural reasons prevent logging TH/TL directly:

  1. No parameter-to-VM mapping. Function block parameters in LOGO!Soft Comfort live in the compiled FBD/LAD program as instance data and are not copied into the variable memory (VM) area. The Data Log dialog browses VM, M, I, Q, AI, AQ - not instance memory.
  2. No symbolic addressing. The Data Log dialog is signal-oriented. There is no symbol table query that could resolve "B006.TH" to a memory location.
  3. No OPC UA exposure of instance data. Only S7-1200/1500 controllers expose block parameters over OPC UA. LOGO! 8 exposes process values, not internal block parameters, even on the Web server (read-only VM browser).

The net effect is that you cannot add TH and TL to a Data Log configuration line. Any solution must derive an equivalent measurement from the actual signal behavior.

5. Edge-Triggered Block Workaround

The community-validated workaround extracts TH and TL implicitly by recording the time-stamp of every rising and falling edge of the pulse generator output. From the resulting CSV you can compute the actual high and low durations by subtracting consecutive timestamps - giving you a verified measurement of TH/TL rather than a value typed in on the HMI.

5.1 Block Selection

The Pulse Generator output (Q at the B006 block) feeds two edge detectors in parallel:

  • NAND with edge evaluation - detects the falling edge of the pulse (transition from 1 to 0). The output produces a one-shot pulse of one LOGO! cycle (typ. <10 ms).
  • AND with edge evaluation - detects the rising edge of the pulse (transition from 0 to 1). The output produces a one-shot pulse of one LOGO! cycle.

Both edge-detector outputs are then combined with an OR function so that the resulting signal goes high for one scan on every transition of the pulse - rising or falling. This combined edge pulse becomes the trigger input of the Data Log block.

5.2 Why One Edge Is Insufficient

Triggering the Data Log only on the rising edge gives you TL plus TH together (the period). Triggering only on the falling edge gives you the same period from the opposite side. You cannot separate TH from TL with a single edge. By triggering on both edges you receive a row every time the pulse changes state. Computing (t_falling - t_rising) yields TH; computing (t_rising_next - t_falling) yields TL. This matches what a stopwatch would read, but is recorded automatically without any external instrument.

5.3 Block Diagram (SVG)

Pulse Generator B006 (TH / TL) AND with edge rising-edge detector NAND with edge falling-edge detector OR block 1-shot on every edge Data Log block trigger on every edge writes timestamp + Q-state

6. Step-by-Step Implementation

6.1 Build the Program Skeleton

  1. Open LOGO!Soft Comfort V8 and create a new project.
  2. Drag a Pulse Generator (Special functions > Timers > Pulse Generator) onto the FBD canvas.
  3. Connect a digital input to its trigger so the pulse can be enabled/disabled.
  4. Connect a flag M1 to the input of the Pulse Generator if the program should run unconditionally once started.

6.2 Add the Edge-Detection Logic

  1. From the BN (Boolean/Numeric) function group, place an AND with edge evaluation block. Wire the Pulse Generator output Q to its input.
  2. Place a NAND with edge evaluation block. Wire the same Q signal to its input.
  3. Place an OR block. Wire the outputs of both edge blocks to the OR inputs.
  4. The OR output is now a one-cycle pulse on every transition of the Pulse Generator output.

6.3 Configure the Data Log

  1. From the Special function group, drag a Data Log block onto the canvas.
  2. Wire the OR block output to the En (enable / trigger) input of the Data Log.
  3. Open the Data Log configuration dialog. Add two rows:
  • Row 1: VM0 (or any unused analog word in VM) - the program writes the current Pulse Generator output Q state into VM0 just before each trigger so the CSV captures both the timestamp and the output state.
  • Row 2: Timestamp - the second column is filled automatically by the Data Log block with the BM date/time at the moment the trigger fires.
  1. Set the storage medium: Internal Flash for diagnostics, or SD Card for long-term capture. The internal flash can hold ~16 384 rows; the SD card is bounded only by free space (FAT16/32, ≤8 GB recommended).
  2. Set the file naming mode to "One file per day" so each shift produces its own log00001.csv file with a date suffix.

6.4 Mirror the Pulse Generator Output into VM0

Because the Data Log dialog does not expose the Pulse Generator's output Q directly through a block parameter, use a small helper:

  • Place an Analog Flag or a flag-to-VM mapping. In LOGO! 8 the cleanest way is to drag a Threshold Switch or assign a flag M2 = pulse Q, then write M2 into VM0 by enabling VM0 as the destination of a Boolean-to-Analog conversion.
  • Practical alternative: drive a digital output that is internally wired to a VM word in LOGO!Soft Comfort's variable table. Most projects simply allocate VM0 = Q-output of Pulse Generator via a flag assignment followed by a numeric conversion block.
If capturing the output state is not strictly required, configure only one row (timestamp). The trigger alone is enough to compute TH and TL offline from the timestamps alone.

6.5 Compile and Download

  1. Press F5 to compile the project. Verify no warnings about block count or memory limit.
  2. Connect the PC to the LOGO! 8 BM via Ethernet (the 230RCE has an on-board RJ45).
  3. Click PC → LOGO! and select the network adapter. The download dialog displays the firmware comparison. Accept the firmware update only if it is upward compatible; never downgrade a FS:04 BM to an earlier FS, otherwise the project archive becomes invalid.
  4. After download, switch the BM to RUN. The Data Log begins recording when the Pulse Generator output first transitions.

7. Data Log Memory, CSV Format, and Post-Processing

7.1 Memory Budget

Each CSV row consumes 32 bytes of internal flash on the BM. With the 16 384-row limit, the BM can capture roughly 10 hours of pulses when the period is ~2 s. For longer campaigns insert a 6ED1056-1BA00-0AA0 SD card to offload the data automatically.

7.2 CSV Layout

The default CSV produced by the LOGO! Data Log looks like:

Date;Time;VM0
2024-05-12;08:15:01.234;1
2024-05-12;08:15:03.456;0
2024-05-12;08:15:05.678;1

The semicolon separator is configured in Tools > Options > Data Log. For direct import into Excel or LibreOffice Calc, leave the default separator unchanged.

7.3 Computing TH and TL from the CSV

Once the CSV is exported (via SD card or Web server > Data Log > Download), use the following procedure:

  1. Sort the rows by timestamp ascending.
  2. For each row where VM0 transitions from 0 to 1, mark it as a rising-edge timestamp (TR_n).
  3. For each row where VM0 transitions from 1 to 0, mark it as a falling-edge timestamp (TF_n).
  4. Compute TH_n = TF_n - TR_n.
  5. Compute TL_n = TR_(n+1) - TF_n.

A simple Python script automates this:

import pandas as pd
df = pd.read_csv('log00001.csv', sep=';', parse_dates=['Time'])
df['edge'] = df['VM0'].diff()
rising  = df.loc[df['edge'] == 1, 'Time'].tolist()
falling = df.loc[df['edge'] == -1, 'Time'].tolist()
th = [(f - r).total_seconds() for r, f in zip(rising, falling)]
tl = [(r2 - f).total_seconds() for r2, f in zip(rising[1:], falling)]
print('TH samples:', th)
print('TL samples:', tl)

8. The "Header" Question - Single-Shot Static Parameter Logging

The original poster also asked whether the Data Log could carry a static header line containing parameter values that do not change during the run. The short answer is no - the Data Log block writes only its configured rows and never a free-form text prefix.

Three practical workarounds:

  1. Initial trigger pattern: Hold the Pulse Generator output low for one full period (TL > typical TH) before enabling the run. The first long interval in the CSV implicitly identifies the start of the run and can carry project metadata in a separate manual log.
  2. Pre-flight text log via the LOGO! Display: Display TH and TL on the LOGO! TD screen at program start. The display content is not exported, but it serves as the human-readable header.
  3. Use an external data source: Track TH/TL changes in a separate text file maintained on the PC. Match each CSV row to the TH/TL pair that was active when the row was written by using the LOGO!'s RTC timestamp as the join key.

9. Verification and Acceptance Test

  1. Set TH = 5.000 s, TL = 7.000 s with a time base of 1 s. Compile and run.
  2. Let the program run for at least 5 minutes to capture >20 rows.
  3. Pull the SD card, open log00001.csv in a spreadsheet.
  4. Confirm at least 10 rising edges and 10 falling edges are present.
  5. Compute TH from the timestamps - expected value 5.000 s ± 1 scan period (typically ± 10 ms).
  6. Compute TL from the timestamps - expected value 7.000 s ± 1 scan period.
  7. If the values drift, increase the time base (e.g., from 100 ms to 1 s) so that the resolution quantisation error is below the acceptable tolerance.

10. Troubleshooting Matrix

Symptom Root cause Remedy
Data Log CSV is empty after run SD card not formatted FAT16/32, or trigger never fires Re-format card with FAT32, verify OR block output with a flag indicator
CSV has rows but only timestamps, no VM0 values VM0 was not assigned; Data Log configured for timestamp only Add VM0 row in the Data Log dialog; ensure the assignment to VM0 is in RUN
Every row shows the same timestamp Trigger is held high continuously because NAND edge block was placed incorrectly Verify the NAND block is wired with edge evaluation enabled (small triangle symbol present)
TH/TL computed values double the expected Both edge blocks trigger twice per period because the Pulse Generator output was inverted somewhere Trace the Pulse Generator output with the LOGO!Soft Comfort online monitor
Memory full warning on BM Internal flash limit reached without SD card Insert an SD card or reduce the trigger rate
Download fails with "Firmware mismatch" LOGO!Soft Comfort project archive is for a different FS version than the BM Match the FS version under Tools > Select Hardware to the BM label

11. Alternatives Beyond LOGO!Soft Comfort

The Data Log feature is a lightweight facility designed for the LOGO! 8 price point. If static parameter headers, high sample rates, or OPC UA exposure of instance data are required, consider migrating to a larger Siemens controller:

  • S7-1200 with DataLog instructions in the user program and 1 MB retentive memory.
  • S7-1500 with native OPC UA server, recipe handling, and trace functionality.
  • LOGO! 8 + LOGO! CMR 2020: cellular router that can push the CSV to an FTP server for centralized logging.

For the LOGO! itself, the only programmatic tools that are richer than LOGO!Soft Comfort are the open-source FBD/LAD editors built on the LOGO! Modbus TCP interface - but those still do not extend the Data Log block's functionality; they only read the variables it exposes.

Can the LOGO! 8 Data Log block log block parameter values such as TH and TL directly?

No. The Data Log block only supports process signals (I, Q, M, AI, AQ, VM). Block instance parameters are not mapped to VM, so they cannot be selected in the Data Log configuration dialog. Use the edge-trigger workaround described in this article to derive TH and TL from the timestamped output transitions.

How do I add a static header line to the LOGO! Data Log CSV?

The Data Log block does not write free-form header text. Workarounds include starting the run with a known long TL so the first interval is identifiable, displaying TH/TL on the LOGO! TD, or maintaining a sidecar text file joined on the RTC timestamp.

What SD card works best with LOGO! 8 for data logging?

Use the Siemens LOGO! SD card (6ED1056-1BA00-0AA0) up to 8 GB, formatted FAT16 or FAT32. Cards larger than 8 GB are not guaranteed to mount on every BM firmware revision.

Which edge block should I use - AND with edge, NAND with edge, or OR with edge?

Use AND with edge for rising-edge detection and NAND with edge for falling-edge detection. Combine both with an OR block so that the Data Log trigger fires on every transition of the Pulse Generator output, giving you one CSV row per pulse edge.

Can I read TH and TL from the LOGO! 8 over Modbus TCP?

Modbus TCP on LOGO! 8 exposes VM memory, inputs, outputs, flags, and certain counters/timers but not block parameter instance data. TH and TL remain inaccessible via Modbus; the edge-trigger approach is still required.

Back to blog