Ignition Modbus vs KepServer Modbus Zero Based Addressing

Just going to leave this here for anyone else that may run into this issue when doing a conversion from KepServer drivers to Ignition drivers or vice-versa.

Zero based addressing in Ignition means that whatever register you try to read, when zero based is enabled/set, that address is passed directly on the wire as the same register. If you have zero based addressing disabled (meaning you're using 1 based addressing), then the register on the wire is 1 lower than the register you've entered in the configuration to read. This matches what other Modbus tools seem to use as well.

KepServer is just the opposite. If you have zero based addressing enabled, it subtracts 1 from whatever address you tell it to read, and that's what goes on the wire, but with zero based addressing disabled, the register you tell it to read is passed unmodified on the wire. (Completely the opposite of what I would expect and what other software seems to use.)

I don't know why KepServer is like this, but I was fighting converting some tags from an existing KepServer instance to Ignition, and couldn't even get OpenModScan to read the registers how KepServer was reading them, so had to look at the raw data to see the diffrerence on the wire.

Address Ignition 0-Based Ignition 1-Based KepServer 0-Based KepServer 1-Based
Config HR10 HR10 40010 40010
Wire 40010 (10) 40009 (9) 40009 (9) 40010 (10)
2 Likes

Huh, thanks. Never realized they were doing it opposite.

1 Like

Good to know. Can't say I'm surprised. I'm glad I decided to make my driver use the given offset on the wire, unconditionally. (With a hint in OPC browse for comparison.)

1 Like

I think maybe it's how it's being interpreted by them.

Ignition seems to say that all device addresses should be 0-based due to the protocol spec calling out that addresses/registers start at 0. Then you specify if your addresses you're using are 0 or 1 based, so it modifies it from there.

KepServer seems to assume that all addresses you enter into the system will be 1 based (?) and then if you set that the device is 0-based, it subtracts 1, otherwise it passes it straight through? Not even sure that's right, but it doesn't make much sense to me.

Here's the KepServer explanation:
image

vs Ignition driver setting:
image

vs Ignition manual:

The blame really lies on the authors of the Modbus protocol spec, who explicitly state in the spec that it's 0 on the wire and then 1-based in all other data structures and references in the spec. They must have been on something :zany_face:

2 Likes

Kepware is full of it. The pattern established by Modicon in the beginning is that address ranges are presented to the user & programmer starting with x0001 but start with 0 on the wire. With only four digits allowed in UIs back then, there were only 9999 visible addresses, even though some devices actually offered more.

As the protocol started being used as an unofficial standard, a number of implementers chose to show the "on the wire" offset to the user, where the visible range became x0000 to x9999, a full ten thousand addresses. In my 35-year career, this has always been referred to as "zero-based", in exactly the same way programmers use the phrase for how array subscripts work in various languages.

2 Likes