Selection guide
Choosing a PC-based HMI runtime for a Modbus TCP PLC
Short answer
No — C-more projects deploy to C-more panel hardware, so a PC-only interface needs a PC runtime instead. Run AdvancedHMI, a PyQt5 front end with pymodbus, or an Excel VBA socket client as the Modbus TCP client, with the PLC acting as the server on TCP port 502.
On this page
- Can C-more run on a PC without panel hardware?
- Which PC-based runtime should the HMI be?
- Which end is the Modbus TCP server, the PC or the PLC?
- What does a Modbus TCP frame look like when I write my own client?
- Why is my HMI reading the register next to the one I set?
- What does the PLC sketch need before the HMI can poll it?
- How do I verify the link before blaming the HMI?
- Questions asked
No — C-more runtimes live on C-more panel hardware, and a PC reaches a deployed project only through the remote-access client that mirrors a physical panel. For an interface on the same PC that runs the Arduino IDE, use a PC HMI runtime as the Modbus TCP client and let the PLC be the server on TCP port 502. AdvancedHMI, a PyQt5 front end with pymodbus, and an Excel VBA socket client all fill that role without any panel purchase. Below is the choice between them, the frame rules you inherit when you write the client yourself, and the bring-up that proves the link.
Can C-more run on a PC without panel hardware? #
No. C-more projects are built on a PC but they download to C-more operator panels, and a PC reaches a deployed project only through the remote-access client that mirrors a physical panel — so with no panel in the plan, C-more is the wrong tool.
The deciding question is where the runtime executes. Panel-targeted packages assume a hardware target at download time; PC-targeted packages assume a Windows process. Modbus TCP is the common denominator either way, so the protocol does not force the choice — the execution target does. If the interface later has to live at the machine instead of on the desk, the same Windows runtime deploys on industrial panel PCs, and selecting a Modbus TCP HMI panel for an existing controller becomes its own decision at that point.
Which PC-based runtime should the HMI be? #
Pick AdvancedHMI to get working screens fastest, PyQt5 with pymodbus when the project needs custom sampling, timestamping and plots, and Excel VBA over ws2_32.dll only when the spreadsheet itself is the deliverable.
| Runtime | Where it executes | Modbus TCP client | Effort | Best fit |
|---|---|---|---|---|
| AdvancedHMI | Windows PC, .NET application | Built-in driver components | Low: drag-and-drop screen design | Fastest path to a working operator interface |
| PyQt5 + pymodbus | Windows PC, Python process | pymodbus library or raw sockets | Medium: Qt Designer for layout, code for polling | Research work needing custom logging and plots |
| Excel VBA + ws2_32.dll | Windows PC, Excel process | Hand-rolled socket client | High: you build the MBAP framing yourself | Data capture whose deliverable is the spreadsheet |
| C-more | C-more panel hardware | On the panel | Requires the panel hardware | Deployed machines with a physical HMI |
The trade is graphics speed against control over data. AdvancedHMI is a free .NET HMI package with ready Modbus TCP driver components, so the protocol layer is never a variable you debug; it also has its own support forum when you hit a roadblock. PyQt5 gives you Qt Designer for layout and leaves sampling, timestamping and plotting entirely in your code. VBA over ws2_32.dll keeps the data where it ends up, but you implement the framing yourself, byte by byte.
The decision by case: for a research project whose real output is logged data, start with AdvancedHMI to prove the register map and the wiring, then move to PyQt5 once capture and plots matter. If the deliverable is a spreadsheet, write the VBA client and budget time for the framing. Buy panel hardware only when a machine-side station is genuinely wanted, never just to obtain a PC display.
Which end is the Modbus TCP server, the PC or the PLC? #
The PLC is the server and the PC is the client: the controller listens on TCP port 502, the HMI opens the connection and issues every read and write, so a normal HMI PC never needs a listening socket.
| Element | Role | What it takes |
|---|---|---|
| PLC sketch | Modbus TCP server | Ethernet interface up, server library polled every scan |
| PC runtime | Modbus TCP client | Polls coils and registers on a fixed interval |
| Transport | TCP/IP | Same subnet or routed; the PC needs a working route |
| Arduino IDE | Programming only | Uploads coexist with HMI polling on the same PC |
Because the HMI and the Arduino IDE share one PC, check the route before anything else. If the controller sits on a dedicated network card or a USB-to-Ethernet adapter, confirm that Windows uses that adapter for the controller's subnet, or the client will send Modbus frames out the corporate interface and report timeouts against a PLC it never reached. Give the PLC a static address on that subnet so the HMI tags stay valid across power cycles.
What does a Modbus TCP frame look like when I write my own client? #
Every request is a 7-byte MBAP header, then a 1-byte function code, then up to 252 bytes of payload — 260 bytes maximum — with all multi-byte fields big-endian and no CRC, because the TCP layer already checks integrity.
- Bytes 0–1: transaction ID, incremented per request and echoed back by the server
- Bytes 2–3: protocol ID, 0x0000 for Modbus
- Bytes 4–5: length, the count of every byte that follows it (unit ID plus PDU)
- Byte 6: unit ID, commonly 0x00 or 0x01
- Byte 7: function code
- Byte 8 onward: request or response data
| Code | Operation | HMI use |
|---|---|---|
| 0x01 | Read Coils | Lamps and discrete outputs |
| 0x02 | Read Discrete Inputs | Field input status |
| 0x03 | Read Holding Registers | Setpoints, 16-bit values |
| 0x04 | Read Input Registers | Read-only analog data |
| 0x05 / 0x0F | Write single / multiple coils | Pushbuttons, mode bits |
| 0x06 / 0x10 | Write single / multiple registers | Setpoint entry |
Worked example: read 10 holding registers from offset 0, with unit ID 0x01 and function code 0x03. The request PDU is 1 byte of function code, 2 bytes of start address and 2 bytes of quantity, so the length field is 1 + 1 + 2 + 2 = 6 (0x0006) and the whole request is 7 + 5 = 12 bytes on the wire. The response carries 1 byte of function code, 1 byte of byte count and 10 × 2 = 20 data bytes, so its length field is 1 + 1 + 1 + 20 = 23 (0x0017) and the frame totals 7 + 22 = 29 bytes.
The 252-byte payload cap sets the read size: a read response reserves 1 byte for the count, leaving 251 bytes of data, so a single read returns at most 125 registers (125 × 2 = 250 bytes).
Why is my HMI reading the register next to the one I set? #
Because the two sides count from different origins: HMI packages document registers 1-based — 40001 is the first holding register — while the wire carries a 0-based offset, so 40001 maps to 0x0000 and every documented address sits one above the bytes on the wire.
The symptom is a value that is stable and plausible but belongs to the neighboring register. Write one known constant, for example 12345, into a single holding register from the sketch and read it from the HMI: if the constant appears one address early or late, the documentation layer is the cause. Fix it in the HMI tag configuration, not by shifting the register map, or the map and the sketch stop agreeing. In most HMI address documentation the 4xxxx family is holding registers, 3xxxx input registers and 0xxxx coils; the wire never sees those prefixes.
What does the PLC sketch need before the HMI can poll it? #
The sketch needs the Ethernet interface initialized, a Modbus TCP server object started in setup() and serviced every pass of loop(), a register map that moves values in one place each scan, and a static IP so HMI tags stay valid after a power cycle.
Blocking calls in loop() are the usual self-inflicted fault: a long delay stalls the server task and the HMI reports timeouts against a PLC that is running fine. Keep the register map in one header, and move values between the control logic and the register image in one place each scan, so a write from the HMI never lands in a variable the logic is halfway through using. One illustrative convention:
| Documented address | Register | Contents | Scaling |
|---|---|---|---|
| 40001 | HR_SETPOINT | Setpoint | Engineering units × 10 |
| 40002 | HR_MODE | 0 = Manual, 1 = Auto | — |
| 30001 | IR_PV | Process value | ADC counts |
| 00001 | C_START | Start command | — |
| 00002 | C_RESET | Alarm reset | — |
Registers are 16 bits. Publish floating-point values scaled by 10 or 100 with the factor written beside the register, or split a 32-bit value across two consecutive registers and record the word order — displaying a PLC real value over Modbus on an HMI comes down to matching that order on both sides. Keep the emergency stop in hardwired safety hardware: a coil write from an HMI is a command channel, not a safety function.
How do I verify the link before blaming the HMI? #
Work up the stack in order: ping the PLC address, open a TCP session to port 502, then read one register holding a constant the sketch wrote — when that constant comes back correct, framing, unit ID and addressing are proven in a single test.
- Ping the PLC address from the PC. No reply means addressing or cabling, not Modbus.
- Open a TCP session to port 502 from the PC. A completed connect proves the server task is running.
- Read one register holding a known constant. A matching value proves framing, unit ID and addressing together.
- Write one scratch holding register and read it back. If the value differs, the sketch is overwriting it every scan.
- Run the HMI at its production poll rate and watch for exception responses and timeouts.
Read the exception codes rather than guessing: 0x02, Illegal Data Address, means the requested offset or quantity exceeds the register image the sketch declared; 0x03, Illegal Data Value, usually means an out-of-range quantity. Timeouts that appear only when a second client starts often trace to a PLC master/slave conflict or a single-connection server rather than to the HMI — some embedded Modbus servers accept exactly one TCP session, so close any poll utility left open beside the runtime and retest.
The decision, by case: no panel and screens wanted now, AdvancedHMI; research logging and plots, PyQt5 with pymodbus; spreadsheet deliverable, VBA sockets; a station at the machine later, the same Windows runtime on panel PC hardware. None of these cases buys an operator panel just to obtain a PC display.
Questions asked
Does the PC running the HMI also need a static IP address?
No. Only the PLC side must hold a fixed address, because the HMI tag configuration points at it. The PC can use DHCP as long as it keeps a route to the PLC subnet; if you add a dedicated network card for the controller, check that Windows sends the PLC traffic out that adapter and not the corporate one.
Can two Modbus TCP clients poll the PLC at the same time?
Yes, when the server library accepts multiple sessions — Modbus TCP has no master token, so any number of clients may connect and each polls independently. Many embedded server libraries accept only one TCP connection at a time, and a diagnostic poll utility left open beside the HMI then starves one of the two, so close the extra session and retest.
How do I check the word order of a 32-bit value in two registers?
Write a known value such as 1.5 from the HMI and read both registers back. In big-endian word order the first register holds 0x3FC0 and the second holds 0x0000; if the pair appears reversed, the two sides disagree on word order and you swap the words on one side only. Record the working order in the register map.
Is Modbus RTU over RS-485 a workable fallback?
It works, but it changes the client side. The PC needs a serial adapter, frames carry a station address and a CRC instead of the MBAP header, and only one master polls the bus at a time. For a PC HMI sharing one cable with the controller, Ethernet with Modbus TCP is the simpler path.