Slave device timeout error

208 views
Skip to first unread message

Ibraim

unread,
May 14, 2009, 7:35:14 PM5/14/09
to NModbus
Hi All,

First I want to say: thanks for all this work. I'm using NModbus in a
multiple devices applications. I have a connection (Can be TCP or RTU)
and multiple devices with different slave identifier.

My problem is I can't figured out a way to get a device timeout, let
me explain in this way:

* If for some reason the master tries to communicate with a slave that
doesn't exists, is return and exception with the Function Code: 131
and the Exception Code:2. I think the correct thing to do here is to
return a timeout error, because the device isn't present.
* I did another test trying to get a register that don't exist in a
device that is correctly connected, let's say the device with the ID 2
is present but I want to read register 100 that is not present, the
answer is the same as above case.

I did some test using the TcpClient ReceiveTimeout property without
results.

Can you help how can I get this error in a way I can know that the
device is not present.

Thanks in advance for all your help.

Scott Alexander

unread,
May 15, 2009, 1:25:47 AM5/15/09
to NModbus...@googlegroups.com
If you want a timeout you can either set the
RecevieTimeout/SendTimeout properties on the TcpClient or the
IModbusMaster.Transport.ReadTimeout/WriteTimeout properties.

When you're using Modbus over TCP/IP the slave address is ignored as
the slave is being addressed by IP.

The fact that you're receiving a slave exception response indicates
that the device does indeed exist on the network. Function Code 131
represents an exception that occurred during a ReadHoldingRegisters
request, Exception Code 2 is for an illegal data address.

Scott
Reply all
Reply to author
Forward
0 new messages