Missing exception code under Open Modbus?

A

Thread Starter

Anonymous

Are there any exceptions codes under Open Modbus that are valid if someone accidently attempts to write to a read-only register?

It seems under open modbus that there is no reference to 3xxxx and 4xxxx addresse like their used to be under standard Modbus. Because of this, it is relatively easy to attempt to write to a read-only address. I expect it is upto the slave device to reject the command and return an approproate error code. Looking through the Open Modbus Spec 1999, however, there does not seem to be an error code that says something like "Invalid operation on read-only register".

Currently existing exception codes like "Illegal Function" cannot be used because the write function is valid for the slave. "Invalid Data address" cannot be used because the data address is valid, it just so happens that it is a read-only address", and so on.
 
A

Alex Pavloff

<P>&gt; Are there any exceptions codes under Open Modbus that are valid if someone accidently attempts to write to a read-only register?&lt; </P>

<P>&gt; It seems under open modbus that there is no reference to 3xxxx and 4xxxx addresse like their used to be under standard Modbus.&lt; </P>

<P>"3xxxx" addresses don't have a write command. You can read the "3xxxx" addresses with the Read Input Registers (fc 4) command, but every other
register command refers to the "4xxxx" (holding) registers.</P>

<P>Now, the same register may be in both places, so you may actually have a register that is "read-only" but in the 4xxxx address space. In that case, what I do in my implementation is just ignore what the guy was telling me to do. He can't write it, but it is a completely valid address and write command.</P>

<P>If you want to throw an error, I see what your problem is -- none of the error messages are exactly close to what you want to do. For compatibility, your best bet will be to pick error 1 or error 2. </P>

<P>Now, one thing that I just noticed in the IETF modbus specification
( <a href="http://www.ietf.org/internet-drafts/draft-dube-modbus-applproto-00.txt">http://http://www.ietf.org/internet-drafts/draft-dube-modbus-applproto-00.txt</a> ) is
an additional error packet.</P>
<PRE>
255 EXTENDED Indicates the mb_exception_rsp_pdu contains
EXCEPTION extended exception information. A subsequent
RESPONSE two-byte length field indicates the size in
bytes of the function code specific exception
information.
</PRE>
<P>The question then becomes -- could a master understand that error packet?</P>

<P>Alex Pavloff
<BR>Software Engineer
<BR>Eason Technology</P>
 
G

Greg Goodman

> Are there any exceptions codes under Open Modbus that are valid if someone
> accidently attempts to write to a read-only register?

How do you plan to specify an input register in a "write one holding register" message?

Any register number you specify in connection with function 16 (write multiple registers) or function 6 (write single register) is assumed to
refer to a holding register.

Greg Goodman
Chiron Consulting
 
Top