We're developing a modbus device. A customer recently reached out to us and requested that our device NOT return an error if a "read multiple coil/register" request included a register address that didn't exist.
For example, lets say i have coils 1, 2, 3, 8, 9, 10 defined.
The customer wants to send a "read multiple coils" command, with starting address 1, and ending address 10.
The customer wants our device to "skip" the invalid coils (and pad the return data with zeroes where a real coil doesn't exist), and return that the request was valid (ie, let's say that coils 1, 2, 3, 8, 9, 10 all contain the value 1. The customer wants to see: 1,1,1,0,0,0,0,1,1,1).
When I read the spec, it seemed to me that it should generate an error, but the customer insists that other companies are doing this.
Does anyone know which is correct?
We develop a SCADA system that uses Modbus with all kinds of devices. I have seen devices handle this issue both ways. Some will send an error and some will return 0 or ffff. I think ffff is better.
From my point of view it is much better for a device not return an error. The reason being is it can be much more efficient to issue a single request than have to send multiple requests.
My suggestion is to go with your customers suggestion or at a minimum make it configuration via a Modbus register. Hope that helps.
I don't know how other companies are doing this but I know there are a lot of different interpretations.
But on the other hand I don't see a problem with your customers request. By padding the unused data with zero's he can get a range of coils/registers in one telegram what will improve communication speed. He also has to use your Modbus register table to determine the values he wants to read, so if he reads an unused coil/register it's his responsibility.
Of course if there are huge gaps between used coils/registers I would give an error reply. For small gaps it is faster to have only one read command instead of two or more.
Another thought is why are you not using a consecutive range of registers. This would be even better practice so you don't have any gaps and makes communications much more efficient.
>Another thought is why are you not using a consecutive
>range of registers. This would be even better practice so
>you don't have any gaps and makes communications much more
The firmware we're working on is a contract from another company. They've defined their Modbus table to be universal-ish between multiple devices (they do motor control drives). So "Set speed" will always have the same address in every device. However, not every device employs all the same functionality, thus the gaps.
On our end, we're basically just making the Modbus high and mid-level drivers for them. It's technically their customer that wants the change, and the company was asking us to implement it, but we didn't want to be non-standard, thus why I asked the question.
Thanks for your replies!