LOGO! 8 Parameter VM Mapping for KTP400 Counter Setpoints
This reference explains how to expose the On and Off threshold parameters of a LOGO! 8 counter block to a SIMATIC KTP400 Basic HMI through the variable memory (VM) area. It resolves a common field problem: the HMI's Network Analog Input (NAI) tag is 16-bit signed, while the counter reference value is a 32-bit unsigned integer — so the value must be routed through a Parameter VM Mapping entry and accessed as a VD (double word).
1. Problem Description
You have a LOGO! 12/24 RCE (order code 6ED1052-1MD08-0BA1) networked to a SIMATIC KTP400 Basic (for example, from starter kit 6AV2132-0KA00-0AA1) and want to:
- Enter an integer on the KTP400 (IO field).
- Push that integer into a counter block running inside the LOGO! (e.g. block C001).
- Use the entered value as the On threshold or Off threshold of the counter so it turns its output on/off at a user-defined count.
You create a Network Analog Input tag and point it at VW6. The HMI shows a value, but it never updates the counter, and the LOGO! does not respond to changes from the panel. This is a data-type mismatch, not a wiring problem.
2. Root Cause: 16-bit NAI vs. 32-bit Counter Reference
LOGO! counter blocks (special function blocks 001 Up/Down counter and 002 On/Off counter / hours counter) store their On and Off reference parameters as 32-bit unsigned integers (DWORD, range 0…2,147,483,647). The VM (variable memory) area in LOGO! 8 is byte-addressable as follows:
| Symbol | Width | Range | Typical Use |
|---|---|---|---|
| Vx.y | 1 bit | V0.0…V850.7 | Digital flags, outputs |
| VBx | 1 byte | VB0…VB850 | Byte-level data |
| VWx | 16 bits (signed INT) | VW0…VW850 | NAI/NMQ accessible (HMI side) |
| VDx | 32 bits (DWORD) | VD0…VD848 | Counter thresholds, setpoints, totalizer values |
When you map a counter's On/Off reference into the VM, the LOGO! always places it in a VD address. The KTP400 Basic, however, only offers 16-bit signed NAI tags, so reading or writing VW6 alone can only see half of the double word that lives at VD6 (i.e. VW6 + VW8). The other half — and the sign bit interpretation — are lost, so the counter never receives a valid value.
3. How Parameter VM Mapping Works
LOGO! Soft Comfort (LSC) exposes a dialog at Tools > Parameter VM Mapping. Each entry in this table binds a specific block parameter (an On reference, Off reference, actual value, setpoint, etc.) of a special function block (SFB) to a VM address in the LOGO!. The mapping is stored inside the LOGO! program (.lsc project) and is downloaded with the program to the base module. Once enabled, the parameter is reachable from the HMI at the VM address you selected, in the correct data width.
Key behaviors:
- You define the mapping in LSC, not in TIA Portal. TIA Portal only consumes the resulting VM area.
- The mapped VM address must be free — i.e. not already used by another mapping or by a block that owns that range.
- Counter reference parameters (On/Off threshold) are always forced to VD entries (32 bits). Bit and word ranges are rejected for these parameters.
- Read-only parameters (e.g. the actual counter value) are still writable from the HMI if you map them — the LOGO! accepts the write and overrides the SFB value at the next scan.
4. Prerequisites
| Item | Requirement |
|---|---|
| LOGO! base module | LOGO! 8 series (e.g. 6ED1052-1MD08-0BA1, 6ED1052-1HB08-0BA1, 6ED1052-1FB08-0BA1) |
| Firmware | LOGO! 8 FS04 or newer recommended (≥ V8.4) for stable VM mapping of counter parameters |
| LOGO! Soft Comfort | V8.4 or newer (must match or exceed the LOGO! firmware) |
| TIA Portal | V16 / V17 / V18 with LOGO! HSP installed |
| HMI | KTP400 Basic (6AV2123-2DB03-0AX0) or KTP700 Basic; runtime ≥ V15.1 |
| Network | Ethernet switch, LOGO! IP and HMI IP in same subnet |
| Connection | LOGO! Modbus TCP server enabled, HMI configured as Modbus TCP client |
5. Step-by-Step: Build the Counter Setpoint Path
5.1 Add the Counter Block in LSC
- Open your project in LOGO! Soft Comfort.
- Drag a counter block (e.g. B001 = Up/Down counter, SFB type 001) onto the schematic.
- Wire a digital input to Trg (count input) and a reset signal to R.
- Wire the counter output Q to whatever you want to switch (lamp, contactor, flag).
- Double-click the block and open the Block Properties dialog. Under Parameter you will see On and Off threshold fields, initially set to constants (e.g.
10).
5.2 Open Parameter VM Mapping
- In LSC, select Tools > Parameter VM Mapping.
- The dialog lists all mappable parameters of all SFBs in the program. Locate the rows for your counter (Block 001, parameter names: On reference, Off reference).
- For the On reference row, click the Address cell and type a free VD address, for example
VD20. - For the Off reference row, type a second free VD address, e.g.
VD24. Keep at least 4 bytes between mappings to avoid overlap. - Confirm the dialog (OK). The mapping is now part of the program.
5.3 Download the Program to the LOGO!
- Connect PC → LOGO! via Ethernet (or USB on newer LOGO! 8.3+ base modules).
- In LSC, click Transfer > PC → LOGO! and select LOGO! program + Parameter VM mapping.
- Wait for the green confirmation. The LOGO! will be in STOP briefly during the transfer.
5.4 Connect the LOGO! in TIA Portal
- Open your TIA Portal project (V16 or newer) that already contains the KTP400 Basic device.
- In the project tree: Devices & Networks > Add new device > SIMATIC LOGO! 8. Select the correct order number so that the HSP matches the physical module.
- On the LOGO! device, open Properties > System IP and assign a static IP (e.g.
192.168.0.10, mask255.255.255.0). - Drag a network connection from the LOGO! Ethernet port to the KTP400 Ethernet port. TIA will suggest a S7 connection; for VM access from the HMI you need a Modbus TCP connection instead — see §5.5.
5.5 Configure Modbus TCP on the LOGO! Side
- On the LOGO! device object, open Properties > Modbus TCP and enable the Modbus TCP server.
- Default port is
502. The server is read-write, so VM data is bidirectionally accessible from the HMI. - Verify from the PC with a Modbus client (e.g.
mbpollor QModMaster): read holding registers starting at the address that corresponds toVD20. For LOGO! 8, the Modbus base address for VM is typically40001;VD20therefore lines up with holding register offset20(function code 0x03 for read, 0x06 / 0x10 for write).
5.6 Define the HMI Tags
- On the KTP400, open HMI tags and create a new connection of type Modbus TCP, pointing to the LOGO! IP
192.168.0.10:502. - Add an IO field tag named
Counter_OnRef:- Connection: the Modbus TCP connection above
-
Address: offset corresponding to
VD20 -
Data type:
UIntorDWord(32-bit) — do not pickInthere - Length: 2 words
- Acquisition: Cyclical continuous, 1 s
- Repeat for
Counter_OffRefat theVD24offset. - Place two IO fields on the screen, both configured as Input/Output with the format pattern
9999, min 0, max 9999.
5.7 Compile and Download
- Compile the HMI project, then download to the KTP400.
- Restart the LOGO! to RUN. Enter a value, e.g.
5, in the On-ref IO field. Touch the field to write. - Count the input past 5 — the counter output
Qshould switch on. Change the IO field to20— the threshold is now live and the counter will only switch at the new value.
6. Verification Procedure
- From the LOGO! onboard display (or LOGO! Web Server), navigate to Diagnostics > VM and confirm that
VD20shows the value you typed in the HMI. - In LSC online mode, open the counter block properties. The On reference should display the new value, indicating that the SFB is reading the mapped VM address.
- Watch the actual count value while the input toggles. The output should switch exactly at the threshold you set on the HMI.
- Power-cycle the LOGO!. After restart, the threshold should still be the last value the HMI wrote — VM is retentive for mapped parameters only when the LOGO! backup battery / SD card is present; otherwise the parameter returns to its compile-time default.
7. Parameter VM Mapping Reference Table
| SFB Type | Block | Parameter | Data Width | Suggested VM Range |
|---|---|---|---|---|
| 001 – Up/Down counter | B001+ | On reference | 32-bit unsigned | VD20 |
| 001 – Up/Down counter | B001+ | Off reference | 32-bit unsigned | VD24 |
| 001 – Up/Down counter | B001+ | Start value | 32-bit unsigned | VD28 |
| 002 – On/Off counter (hours) | B0xx | On time / Off time | 32-bit unsigned (ms) | VD30, VD34 |
| 003 – Up/Down counter w/ analog threshold | B0xx | On threshold | 32-bit | VD40 |
| 003 – Up/Down counter w/ analog threshold | B0xx | Off threshold | 32-bit | VD44 |
8. Troubleshooting Matrix
| Symptom | Likely Cause | Action |
|---|---|---|
| HMI IO field always shows 0 | Modbus TCP disabled on LOGO! | Re-enable server in LOGO! properties; ping the IP from the panel |
| HMI shows negative value on entry | Tag data type is signed Int (16-bit) | Change HMI tag to UInt/DWord and length 2 words |
| Counter never reaches its threshold | Parameter VM Mapping not downloaded to LOGO! | Use LSC Transfer → "LOGO! program + Parameter VM mapping" |
| Value snaps back to compile-time constant | Mapping exists in TIA but not in LSC | Build the mapping in LSC, not in TIA, then re-download |
| Overlap with another block's VM use | Two parameters mapped to the same VD | Re-lay out VM range with 4-byte spacing minimum |
| Threshold lost after power cycle | Parameter not marked retentive, no battery/SD | Set the parameter to Retentive in LSC or fit a LOGO! Battery card 6ED1057-1BA00-0BA0 |
| Value is written but counter ignores it | NAI tag was used (16-bit) and only the low word of VD is updated | Replace NAI with a 32-bit Modbus tag or HMI raw DWORD tag |
| Field says "Address not valid" | VW used where VD required by parameter type | Change the mapping to a free VD address; VW is rejected for counter references |
9. Common Engineering Pitfalls
- Editing the VM address in TIA only. The mapping must live in LSC; TIA only reads the VM image. TIA-side address changes are cosmetic and disappear at the next download.
- Sharing a VD with a VW the program already uses. LOGO! will silently corrupt the data. Document every mapped address in the schematic comment.
- Forgetting to enable Modbus TCP. The default TIA connection wizard prefers S7; switch the connection type on the HMI side to Modbus TCP for VM access.
-
Using I/O field limits that exceed 16-bit. With
Inttags the panel will clamp at 32767 silently. Switch to UInt/DWord on the HMI tag definition. - Mixing LOGO! 0BA7 and 0BA8 programs. VM mapping format changed between firmware generations; rebuilding the program in the matching LSC version is required.
10. Field-Proven Patterns
For a single-counter machine (e.g. a parts counter with operator-adjustable batch size), the minimum useful setup is two IO fields, two mapped VD addresses, and a counter block. For multi-counter panels, allocate one VD block per counter starting at VD20, increment by 8 bytes per block (4 bytes for On, 4 bytes for Off, optional 4 bytes for Start), and document the layout in the schematic header.
When a HMI is later replaced with a Comfort Panel (KTP1200 / TP1500) using S7 routing instead of Modbus TCP, the VM mapping stays the same — the new panel reads the same VM range via S7 PUT/GET or symbolic DB. The LSC side does not change, which protects the field investment when the HMI is upgraded.
11. Verification Checklist Before Handover
- All mapped VD addresses are listed in the schematic comment block.
- LSC download report shows "Parameter VM mapping transferred successfully".
- HMI online diagnostics shows the Modbus TCP connection in Connected state.
- Writing each threshold from the HMI is reflected in the LOGO! online view within one scan.
- Power-cycle test: thresholds survive at least 10 s of power loss with battery fitted.
- Counter output toggles at exactly the entered threshold; no +1/-1 offsets.
FAQ
Why does my Network Analog Input (NAI) tag not update the counter threshold?
NAI tags are 16-bit signed integers, while the counter On/Off reference is a 32-bit unsigned value. Use a Modbus TCP tag of type UInt/DWord (2 words) pointed at the Parameter VM Mapping VD address, and re-download the LSC program with the mapping enabled.
Where do I configure Parameter VM Mapping?
In LOGO! Soft Comfort, open the menu Tools > Parameter VM Mapping. Pick a free VD address for each counter reference, confirm with OK, then transfer the program to the LOGO! using Transfer > PC → LOGO! > LOGO! program + Parameter VM mapping.
What address should I avoid for VM mapping?
Avoid VD0 to VD19 because some LOGO! 8 firmware versions reserve that area for internal flags and system data. Start at VD20 and keep at least 4 bytes between mapped parameters to prevent overlap with other SFBs and digital flags.
Can I write a counter threshold from the HMI without Modbus TCP?
Yes, by using the LOGO! Web Server API (HTTP GET/POST) from a Comfort Panel with a script, or by reading the counter status via the S7 connection and using a server-side PUT. For a KTP400 Basic the supported path is Modbus TCP, because the Basic panels do not support S7 PUT/GET.
Does the threshold survive a power loss?
Only if the parameter is flagged Retentive in the counter block properties and the LOGO! has a working backup (battery card 6ED1057-1BA00-0BA0 or micro SD). Without retention, the value reverts to the value compiled into the program at next power-up.