devmonkZA / nmodbus

Automatically exported from code.google.com/p/nmodbus
0 stars 0 forks source link

ReadWriteMultipleRegisters - The write operation is not performed before the read. #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. If you are reading register value at the same register address as you
are writting, then you obtain old data before write part of the function is
applied. 
2. But if you are reading and writing at different register addresses, then
everything seems OK.
3.

What is the expected output? What do you see instead?

Value of the registers before 0x17 Read/Write Multiple registers:
Register : 20 -> 1
Register : 21 -> 2
Register : 22 -> 3
Register : 23 -> 4
Register : 24 -> 5

0x17 Read/Write is used to read at address 20 5 registers and write at
address 20 5 registers {1,0,3,0,5} at the same time.

Value of the registers after 0x17 Read/Write Multiple registers:
Register : 20 -> 1
Register : 21 -> 0
Register : 22 -> 3
Register : 23 -> 0
Register : 24 -> 5

Value of the registers after 0x17 Read/Write Multiple registers returned by
the 0x17 Read/Write function:
Register : 20 -> 1
Register : 21 -> 2
Register : 22 -> 3
Register : 23 -> 4
Register : 24 -> 5

What version of the product are you using? On what operating system?
Assembly: Modbus (Module: Modbus) Version: 1.9.0.0 (1.9.0.0) 
Assembly: Modbus (Module: Modbus) Version: 1.11.0.0 (1.11.0.0)
Windows XP SP3 Eng ver.

Please provide any additional information below.
From Modbus_Application_Protocol_V1_1b specification:

This function code performs a combination of one read operation and one
write operation in a single MODBUS transaction. The write operation is
performed before the read.

Thank you very much :)

Original issue reported on code.google.com by pluta...@gmail.com on 10 May 2009 at 4:13

GoogleCodeExporter commented 8 years ago
This is an issue with the implementation of the Modbus protocol on the
Modbus Slave you're reading from (your device).

Scott

Original comment by sja...@gmail.com on 11 May 2009 at 6:12

GoogleCodeExporter commented 8 years ago
Actually I am not using any device as a Modbus Slave, I am trying to simulate 
Modbus
communication using your library.

That is from my Modbus Slave, nothing else has been added:

 slaveTcpListener.Start();
 ModbusSlave slave = ModbusTcpSlave.CreateTcp(slaveID, slaveTcpListener);
 slave.DataStore = DataStoreFactory.CreateDefaultDataStore();
 slave.Listen();

Jan

Original comment by pluta...@gmail.com on 11 May 2009 at 8:47

GoogleCodeExporter commented 8 years ago
Ah, you're right, my bad. Will fix.

Original comment by sja...@gmail.com on 11 May 2009 at 6:08

GoogleCodeExporter commented 8 years ago
Fixed in the trunk. Thanks for the feedback.

Original comment by sja...@gmail.com on 11 May 2009 at 6:35