Learn Automation with MINATA #42: Connecting HMI and PLC — Design the Tags and the States Before You Pull Cable
Connecting HMI and PLC: Design the Tags and the States Before You Pull Cable
An HMI is only trustworthy when the tag map, the write permissions and the communication state have been designed all the way from the PLC to the screen. Pulling cable first and thinking about tags afterwards is the fastest route to a system that works today and becomes confusing the moment somebody extends or maintains it.
The tag list is a contract
Every value exchanged between PLC and HMI deserves a name, a data type, a unit and an owner. A naming convention should carry the role and the unit, so that reading the name is enough:
| Tag | Meaning |
|---|
Cmd_Start | A command written down from the HMI to the PLC |
Sts_Running | The real state, reported up by the PLC |
PV_Pressure_bar | A measured value, with its unit |
SP_Speed_rpm | A setpoint |
One agreed tag list lets electrical, software and production speak the same language, and means the next extension does not have to guess at names.
Who writes, and who only reads
One rule matters more than the rest: the HMI does not write directly and scattershot into output bits. The HMI writes to a command tag; the PLC reads that command, checks the permissive conditions, and only then drives the output. That keeps a single decision point for every actuator, and avoids the situation where several places write to the same output and nobody knows which one won on which scan.
The communication state has to be visible
Networks drop. The HMI needs a link-healthy indicator and a rule for stale data: when the link is lost, do not keep showing the last number as though it were still true. Set a sensible timeout, show the time of the last update, and let a value go to an invalid state rather than freezing on a figure that misleads.
Addressing and mapping
Where HMI and PLC come from the same manufacturer, tags usually map straight onto variable names. With a protocol such as Modbus, you need a mapping table of register addresses against tags, maintained per model and firmware. Do not copy a mapping table between devices of different models just because they look alike.
A worked engineering situation
A diagnostic page on the HMI shows the state of the HMI-to-PLC link, a handful of important I/O points, and the program version code. At commissioning or at a shift handover, a technician looks at one page and knows whether the communication is alive and which version of the software is running.
The final tag list, write permissions and address mapping have to agree with the machine record and the documentation of the equipment actually installed.
Common mistakes
- Pulling cable and configuring the link before an agreed tag list exists.
- Letting the HMI write straight into output bits instead of through command tags.
- No lost-link indication, so old values are displayed as if still valid.
- Arbitrary tag names without units, hard to search when the machine grows.
- Copying a register map between different models.
HMI-to-PLC checklist
- [ ] A tag list exists: name, type, unit, owner, read or write.
- [ ] The HMI writes through command tags; the PLC keeps the output decision.
- [ ] There is a link indicator and a rule for data when the link drops.
- [ ] The address mapping matches the exact model and firmware.
- [ ] A diagnostic page shows communication state and version.
Designing tags and states before the cable goes in makes the HMI trustworthy from the first day. #43 goes into Modbus RTU: reading the RS-485 bus correctly before connecting any device to it.
Read more automation knowledge at MINATA: https://minatavn.com/en/blog/industrial-automation
Previous — #41: Basic HMI for a machine: https://minatavn.com/en/blog/automation-41-basic-hmi
Next — #43: Modbus RTU on RS-485: https://minatavn.com/en/blog/automation-43-modbus-rtu
View all MINATA technical articles