when reading protocol_modbus_slave.c in function 1/2 it
seems byte 2 of the response (after the response
header) is the number of bytes of values. Should that
really be two bytes wide like all other modbus "sizes"
or does it not matter?
I've not seen where is the problem...
In the "modbus application protocol v1.1a" official
document, it is written that the byte count field (1 Byte)
specifies the quantity of complete "bytes of data following"
(if number of bits read is not multiple of 8, last data byte
is padded with zeros).
So it seems to me that is the case...No?
Bye.
PS: in some old doc (TSX plc), there is a mistake for
function 1/2: 2 bytes written instead of 1 for the quantify
of bytes, but the example following the description is okay.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Byte count for the return of function 1/2 returned is only 1 byte in the Modbus application spec... You're thinking of register/coil/input addresses, which have a 16 bit extent.
The byte count can logically only be 8 bit, as the entire PDU is only 253 bytes. You could return 2008 bits of data in one PDU, (251 bytes available in the return packet) which is outside the addressing spec for modbus anyway, as you can only address 2000 continuous coils.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=227913
Hello,
I've not seen where is the problem...
In the "modbus application protocol v1.1a" official
document, it is written that the byte count field (1 Byte)
specifies the quantity of complete "bytes of data following"
(if number of bits read is not multiple of 8, last data byte
is padded with zeros).
So it seems to me that is the case...No?
Bye.
PS: in some old doc (TSX plc), there is a mistake for
function 1/2: 2 bytes written instead of 1 for the quantify
of bytes, but the example following the description is okay.
The Byte count for the return of function 1/2 returned is only 1 byte in the Modbus application spec... You're thinking of register/coil/input addresses, which have a 16 bit extent.
The byte count can logically only be 8 bit, as the entire PDU is only 253 bytes. You could return 2008 bits of data in one PDU, (251 bytes available in the return packet) which is outside the addressing spec for modbus anyway, as you can only address 2000 continuous coils.
Doh, added the same thing, that was me.. I wasn't logged in.. :-).