Error at slave address #10.

195 views
Skip to first unread message

DODA

unread,
Sep 3, 2009, 11:29:08 AM9/3/09
to NModbus
Hello NModbus!

I have following problem.

My code is

SerialPort port = new SerialPort("COM4");

// configure serial port
port.BaudRate = 115200;
port.DataBits = 8;
port.Parity = Parity.None;
port.StopBits = StopBits.One;

port.Open();

// create modbus master
IModbusSerialMaster master = ModbusSerialMaster.CreateRtu
(port);

master.ReadHoldingRegisters(10, 1, 20);

and take error: "Exception of type 'Modbus.SlaveException' was thrown.
Function Code: 131
Exception Code: 2 - The data address received in the query is not an
allowable address for the server (or slave). More specifically, the
combination of reference number and transfer length is invalid. For a
controller with 100 registers, the PDU addresses the first register as
0, and the last one as 99. If a request is submitted with a starting
register address of 96 and a quantity of registers of 4, then this
request will successfully operate (address-wise at least) on registers
96, 97, 98, 99. If a request is submitted with a starting register
address of 96 and a quantity of registers of 5, then this request will
fail with Exception Code 0x02 “Illegal Data Address” since it attempts
to operate on registers 96, 97, 98, 99 and 100, and there is no
register with address 100."

Could you please help me resolve this problem?

Thanks,
Volodya.
Reply all
Reply to author
Forward
0 new messages