Troubleshooting
Why an HMI Macro PLC Tag Is Missing From the PLC Program
Short answer
Only the second quoted string in a macro line is a candidate PLC tag, and it resolves against the HMI Address Tag Library, which maps the name to a controller address. Unquoted names are macro-local variables that never reach the controller. If no HMI unit sits in the data path, trace the real consumer from the controller's cross-reference and Ethernet client list.
On this page
The tag you cannot find is usually not a controller symbol at all. In an EasyBuilder Pro macro line, only the second quoted string is a candidate PLC tag, and it resolves against the HMI's Address Tag Library, which maps that name to a controller address — the controller project can carry a different symbol at the same address. Unquoted names such as GoodParts and BadParts are macro-local variables, declared and initialized to 0 inside the HMI project; they never exist in the controller. And if the machine has no HMI unit in the data path, the macro project is a leftover and the data reaches its consumer by another route. Work the five checks below in order and take the decision at the end.
Read the macro line and classify every identifier #
Open the macro and read one GETDATA line left to right. The button at the bottom left of the macro editor opens the function list; picking GETDATA from the drop-down at the top fills in the arguments and keeps the data types matched. Every identifier in the line falls into one of four classes:
| Item in the line | What it is | Where it lives |
|---|---|---|
| Unquoted names: GoodParts, BadParts, the three ints and the float | Macro-local or HMI local-memory variables, declared and initialized at the top of the macro; GoodParts and BadParts start at 0 | The HMI project only; the controller never contains them |
| First quoted string, for example M301 | Device name, spelled exactly as in the project's device list | The EasyBuilder Pro device table |
| Second quoted string, for example Goodpartstargetcalc | Tag name in that device's Address Tag Library, which may or may not mirror the controller symbol | The Address Tag Library, PLC-tag view |
| The LW destination | An HMI internal local word | HMI memory |
The macro reference is explicit that a local variable holds its value only inside the macro function or function block that declares it, so a controller search for GoodParts is correct to return nothing. The same layout holds when the first quoted string reads "Weintek Built-in CODESYS": that is still a device name, pointing at the HMI's built-in controller, not a tag.
Decision at this step: if the name you searched is unquoted, stop — it is local and will never appear in the controller. If it is the quoted tag name, go to the library.
Check the Address Tag Library before the controller project #
The macro compiler resolves the quoted tag name against the project's Address Tag Library, not against the controller project. Open the address section in the project window, switch from the local-tag view to the PLC-tag view, and select the device named in the first quoted string.
- The tag is listed: the entry maps the name to a controller address. The HMI name and the controller symbol can differ while the address is identical, so search the controller by the address the library shows, not by the HMI name. Check the entry's data type against the macro variable's type while you are there.
- The PLC-tag view is empty: no controller tags were imported or entered by hand. The macro is then reading something other than the controller you have open, or the device entry is HMI-local. Both point to the next check.
Verify the device entry points at the controller you have open #
Open the device list under system parameters and find the entry whose name matches the first quoted string — M301 in this project. Read three things: the driver or protocol, whether the entry is an HMI-local device or an external controller, and the IP address or port it targets.
- Entry missing: the project was edited or copied from another machine and the name is a leftover. The macro cannot bind it, so add the entry or correct the name.
- Entry is HMI-local: reads and writes stay in HMI memory. There is no controller traffic for this macro at all.
- Entry targets a controller at an IP: compare that IP with the controller you have open. A different IP means you are searching the wrong program. The same IP with a missing symbol means the tag was renamed or deleted since the library was built — match by address, then re-import the tags so the library follows the current program.
For a ControlLogix-class controller the connection side of that binding is covered in connecting a CompactLogix PLC to an HMI over EtherNet/IP. If the IP matches and reads still fail, the link itself is the suspect, and diagnosing intermittent HMI to PLC Ethernet comms hangs covers that branch.
Confirm an HMI is in the data path at all #
What is visible on the machine does not settle this question. Settle it with network and controller evidence:
- Inspect the control cabinet and the network switch for an HMI-class device, and note the IP of each connected port.
- In the controller project, list every Ethernet partner: I/O configuration entries, message instructions, produced and consumed tags, and any other client that opens a connection to the controller.
- Compare the device entry's IP from the previous check against those partners.
If no HMI exists on the machine, the macro project and its tag library belong to another machine or are a leftover, and the data reaches its consumer by another route. The HMI project cannot show you that route, so trace it from the controller.
Trace the real data path from the controller side #
- Write down the quoted tag names and the device name. These are candidates, not proof.
- Search the controller project with cross-reference, not only the tag editor. A tag used solely inside an instruction parameter or as an alias target is easy to miss in a plain name search.
- If found, record the tag's address or alias target and which routines write it. If not found by name, search by the address from the library entry, if one exists.
- List the controller's Ethernet clients: message instructions, produced and consumed tags, I/O configuration. The program that consumes the data is one of them.
- Take that client's IP and match it to a physical device or PC. That device is the actual consumer, and its configuration holds the real tag mapping.
- Verify: make a known change on the controller tag — a natural part-count increment is best; on a running machine have an authorized engineer write any test value — and watch the consuming program's value step with it. A match on both name and changed value closes the trace.
The same arithmetic settles the symptom that usually starts this investigation: a destination that never moves off zero.
Worked example: a stuck destination means failed reads #
Illustrative inputs, not documented limits: a macro set to execute every 5 s, and a destination LW that still shows its initialized 0 after 30 s of running parts.
30 s ÷ 5 s per execution = 6 executions
Six executions with the destination still at 0 mean six failed reads. The count is not zero; the transfer never lands. That one line of arithmetic turns "the number looks stuck" into "the read fails every time," which points the investigation at the binding and the connection, not at the process.
Decision #
- You searched an unquoted name such as GoodParts: it is a macro-local variable. It will never be in the controller — stop searching for it.
- The quoted tag appears in the library's PLC-tag view: search the controller by the mapped address. A name mismatch between HMI and controller is harmless while the address is identical.
- The PLC-tag view is empty, the device entry is missing or HMI-local, or no HMI exists on the machine: the macro is not the data path. Trace the real consumer from the controller's Ethernet client list and read the tag mapping from that client's configuration.
Questions asked
Why does the destination LW stay at 0 after the macro runs?
A destination that never leaves its initialized 0 means the read failed, not that the count is zero. Three causes cover it: the macro never executes because its trigger object or start condition is not set, the device is unreachable so every GETDATA fails, or the tag resolves but its data type does not match the macro variable. Rebuild the call from the macro function browser so the types line up.
Can I rule out an HMI just because the machine has no monitor?
No. A headless HMI has no screen, so a machine without a visible operator panel can still contain one, and the panel being absent proves nothing either way. Only network and controller evidence settles it: a device on the switch holding the device entry's IP, or that IP appearing in the controller's client list. If neither shows up, there is no HMI in the data path.
The HMI tag name and the controller tag name differ. Does the link still work?
Yes, as long as the address in the HMI Address Tag Library is identical to the controller address. The macro binds through the library's address, not through the name, so the two names can differ without breaking anything. Search the controller by that address. If the controller symbol was renamed or deleted after the library was built, re-import the tags so the library tracks the current program.
What happens when the device name in the macro matches no device-list entry?
The macro cannot bind the quoted name to any controller, so the read or write never leaves the HMI and the destination keeps its initialized value. Correct the name to match an existing entry, or add the device entry with the right driver and IP. Until one of those is done, treat every value that macro produces as unusable.
Which strings from the macro line are safe to search for in the controller project?
Only the second quoted string, the tag name. The first quoted string is a device name from the HMI device list, so searching the controller for M301, or for a built-in-controller device name, finds nothing by design. Unquoted names are macro-local variables and will never appear in the controller.