Closed GoogleCodeExporter closed 9 years ago
Implementation of FC 04 to read input registers would be great. I am able to
read and write coil, but I also need to read data from both holding registers
0x03 and input registers 0x04. Is it even possible to read input registers (in
0x04) range using the current readMultipleRegisters function. If it is how
would I represent register 3594 ?
Thanks
Original comment by prajjw...@gmail.com
on 8 Mar 2013 at 8:45
[deleted comment]
I am not a modbus expert, but looking at the document and the implementation of
the modbus device I am working with allows fairly flexible implementation (from
the eqipment vendor's side).
In the specification (Modbus Application Protocol V1_1b3 ) 4 distinct memory
maps are defined.
Discrete Input - Single Bit - Read Only - FC02 Implemented in
Phpmodbus already
Coils - Single Bit - Read and Write - FC01 Implemented in
Phpmodbus already
Input Registers - 16bit word - Read Only - FC04 Proposal issue 22
Holding Registers - 16bit word - Read and Write - FC03 Implemented in Phpmodbus
According to the modbus specification: "The pre-mapping between the MODBUS data
model and the device application is totally vendor device specific."
In our implementation Iskra Elekronical Analyser we have the following maps:
Logical address Command to Read Physical Address (used within the read command)
Coil 00001 - 09999 FC01 1-9999
Discrete Input 10001 - 19999 FC02 1-9999
Input Registers 30001 - 39999 FC04 1-9999
Holding Registers 40001 - 49999 FC03 1-9999
Original comment by sardnai...@gmail.com
on 10 Mar 2013 at 3:47
To answer your question: correctly implemented modbus device should not allow
reading of an input register with the currently implemented
readMultipleRegisters which maps to FC03 and reads (and addresses) only memory
were holding registers are stored.
The representation of the 3594 depends on the modbus mapping implementation of
the device. Either a detailed device document describing the modbus
implementation of the particular device or a talk to the vendor shall clear the
addressing issue for you.
Original comment by sardnai...@gmail.com
on 10 Mar 2013 at 3:51
[deleted comment]
3594 is an input register so its logical address would be, 33595. When we use a
built-in modbus master protocal of a PLC or HMI device to read a modbus slave
device's input registers using function 04 then that 30001 is automatically
assumed, and 3594 was just one of the many input registers that I need to read.
The device I am dealing with has similar mapping like yours,
Logical address Command to Read Physical Address (used within the read command)
Coil 00001 - 09999 FC01 1-9999
Discrete Input 10001 - 19999 FC02 1-9999
Input Registers 30001 - 39999 FC04 1-9999
Holding Registers 40001 - 49999 FC03 1-9999
Is the readMultipleInputRegisters function you propose functional, has it been
tested ?
Original comment by prajjw...@gmail.com
on 11 Mar 2013 at 3:41
I used/tested readMultipleInputRegisters to read input registers and was
successful in doing so.
Original comment by prajjw...@gmail.com
on 12 Mar 2013 at 1:49
Added to revision r103, thanks sardnailap
Original comment by krakora....@googlemail.com
on 9 Jul 2013 at 8:56
Original issue reported on code.google.com by
sardnai...@gmail.com
on 8 Mar 2013 at 2:13