Skip to content
See packages

Systems

Modbus registers tell you where, not what: the data model at the edge

Modbus carries bits and 16-bit registers, and nothing about what they mean. Connecting a robot or monitor to a PLC means deciding where that meaning lives.

Computing America Hardware. Custom hardware for physical automation and monitoring.

Send the register map
4 min readComputing America
A twisted-pair serial cable screwed into the terminal block of an industrial meter.

In short

  • The specification defines four tables (coils and discrete inputs as single bits, input and holding registers as 16-bit words) addressed 0 to 65535, and says the data model has to be bound to the device application afterwards.
  • Anything larger than 16 bits (a float or a 32-bit counter) is carried by a convention between vendors, so word order differs by vendor and a float can read as nonsense with no error raised.
  • An interface that only forwards registers moves the ambiguity downstream unresolved, and every consumer then reimplements the same scaling table, differently.
  • The decision that matters is whether the model lives at the edge, where one team owns it, or in each consumer, where no single team does.
  • Protocols that carry their own model, such as Sparkplug with its birth and death certificates, give you a place to put the decision. They don't make it for you.

A Modbus register tells you where a value sits, not what it is: there is no type, unit, scale, name or quality. Someone has to attach that meaning, and if the project doesn't decide who, each consuming system decides for itself.

Register 40007 holds 850. Is that a temperature in tenths of a degree, a flow in a unit an engineer chose in 1998, a bitfield of alarm states, or the top half of a 32-bit counter whose bottom half sits in 40008? The answer isn't in the protocol or the response, and often it isn't in any document in the building. A request phrased as "connect the two" sounds like plumbing and gets scoped like plumbing. This part isn't plumbing.

Modbus leaves meaning out by design

The Modbus application protocol specification (opens in a new tab) defines four primary tables (discrete inputs and coils as single bits, input registers and holding registers as 16-bit words), each element addressed from 0 to 65535. It then says the data model has to be bound to the device application, and gives an IEC 61131 object as an example. The binding is somebody else's job by construction. Two consequences follow.

First, anything wider than sixteen bits is carried by convention. A 32-bit float occupies two registers, and which holds the high word and which byte comes first is a choice each vendor made independently. The specification fixes byte order on the wire and says nothing about how a float is spread across two registers. A 32-bit float read with its two registers in the wrong order comes back off by orders of magnitude, with no error from the protocol. The value 1.0 is the registers 0x3F80 and 0x0000 in that order, and read the other way round they decode to about 2.3e-41.

Second, a reading carries no quality. A reading that is stale because the device beneath the controller stopped answering twenty minutes ago looks exactly like a live one. None of that is a defect. It's a 1979 protocol doing what it was designed to do, and working Modbus infrastructure doesn't need replacing to fix it.

Where the meaning goes

Somebody has to say that 40007 is a discharge temperature in tenths of a degree Celsius, valid from minus forty to one hundred fifty, sampled by controller 3, and stale if its heartbeat register has not incremented in ten seconds. That sentence can live in three places.

  1. 1.In each consuming system. The fastest first delivery. The historian, the dashboard and the maintenance system each grow their own scaling table, and the copies drift. When a plant engineer swaps a device and a register block shifts, every consumer changes, and you find them one wrong report at a time.
  2. 2.At the edge. One team owns one model, resolved once, close to the equipment, by people who can walk out and look. The artifact is a tag map, one row per register with its address, type, word order, scale, unit and range, kept under version control by the integrator who commissions the link. It takes longer to deliver the first value.
  3. 3.In the device. Correct where the equipment offers a real information model, which the installed base often doesn't. Realistic for a new capital project.
Fig. 1
  1. Register block moves

    By four

    • To Tag map at the edge
  2. Tag map at the edge

    One row per register; changed once

    • To Historian
    • To Dashboard
    • To Maintenance system
  3. Historian

    No change; else its own scaling table

  4. Dashboard

    No change; else its own scaling table

  5. Maintenance system

    No change; else its own scaling table

With the model at the edge, a moved register block changes one tag map instead of a scaling table in each of three consumers.

What model-carrying protocols add

OPC UA and MQTT with Sparkplug (opens in a new tab) give the decision a place to live, with the shape of the answer fixed. Sparkplug's session model is small enough to state. When an edge node comes online it publishes a birth certificate defining the metrics it's about to report. The specification requires that birth to be published with the MQTT retain flag set to false. A host application that connects later asks the node to republish it, with a Node Control/Rebirth command, and learns what the values mean from the infrastructure, with no spreadsheet. The node also registers a death certificate as the broker's Will message, so a vanished node is announced instead of inferred from silence.

The gain is real, and so is the price. A broker becomes infrastructure with infrastructure's availability needs, the model becomes a versioned artifact somebody must own, and edge devices become stateful participants. On a small plant with a few dozen tags and one consumer, polling registers into a well-named table can be the right answer, and a broker is more architecture than the job needs.

Questions to settle before scoping

  • How many consumers will there be in three years? Each one that holds its own scaling table is another place to change when a register moves.
  • Who owns the register map today, and is it in a document or in a person? If it's a person, the estimate has to include getting it written down.
  • Does anything downstream need to tell stale from current? If yes, the edge has to supply it, from a heartbeat register the controller increments or the time of the last successful poll, with a timeout, because a register value that sits unchanged can't tell you.

Sources

  1. 1.MODBUS Application Protocol Specification V1.1b3 (opens in a new tab), Modbus Organization,
  2. 2.Sparkplug 3.0.0 Specification (opens in a new tab), Eclipse Foundation,

Next step

Send us the register map.

A spreadsheet, a vendor PDF, or a photograph of the one taped inside the panel door. We will tell you what it does not say that your consuming system will have to assume, and where we would put the model.

Reply
A person replies, not a sequence: within one business day, from someone who would be on the engagement.

Packages

Start with a package

Four packages, each with its price on the page. Pick one and buy it online.

Billing