Closed GoogleCodeExporter closed 8 years ago
I think that I found the issue in the ModbusMaster.cs file. It seems that the
ReadInputRegisters function called the internal ReadRegisters function, that
used a
constant function value of Modbus.ReadHoldingRegisters. For this function
alone, I
have fixed it as:
public ushort[] ReadInputRegisters(byte slaveAddress, ushort startAddress,
ushort
numberOfPoints)
{
ReadHoldingInputRegistersRequest request = new
ReadHoldingInputRegistersRequest(Modbus.ReadInputRegisters, slaveAddress,
startAddress, numberOfPoints);
ReadHoldingInputRegistersResponse response =
Transport.UnicastMessage<ReadHoldingInputRegistersResponse>(request);
return CollectionUtil.ToArray<ushort>(response.Data);
}
Original comment by kain...@gmail.com
on 22 Nov 2006 at 7:29
Wow, that's a big bug. It was introduced by a refactoring performed for version
0.0.2 and it also affect ReadInputs. I will release a fix shortly.
Thanks!
Scott Alexander
Original comment by sja...@gmail.com
on 30 Nov 2006 at 4:07
Kainous,
Thanks for the heads up. The fix has been added to the trunk. I push the
binaries to
the website tonight hopefully.
Thanks.
Scott Alexander
Original comment by sja...@gmail.com
on 1 Dec 2006 at 6:00
There is same problem in tcp master. Looks like serial fix was just overlooked
to be
updated in tcpmaster.
To Fix:
in ModbusTcpMaster.cs
Problem Function:
public ushort[] ReadInputRegisters(ushort startAddress, ushort numberOfPoints)
{
return base.ReadHoldingRegisters(Modbus.DefaultTcpSlaveUnitID, startAddress,
numberOfPoints);
}
Fixed Function:
public ushort[] ReadInputRegisters(ushort startAddress, ushort numberOfPoints)
{
return base.ReadInputRegisters(Modbus.DefaultTcpSlaveUnitID, startAddress,
numberOfPoints);
}
Original comment by came...@calacosolutions.com
on 17 Jan 2007 at 10:13
Original comment by sja...@gmail.com
on 2 Dec 2007 at 1:35
Original issue reported on code.google.com by
kain...@gmail.com
on 22 Nov 2006 at 2:09