Modbus RTU Master - ReadInputRegisters Timeout

1,684 views
Skip to first unread message

andx

unread,
Mar 11, 2010, 4:38:35 PM3/11/10
to NModbus
Hi everybody, I'm facing a problem using the ReadInputRegisters
function to read data from 5 slaves connected to the same serial port.

Following the code line:

for each idx ...
...
reg = master(idx).ReadInputRegisters(slvAdd, regAdd, tmpStr)
...
next

I'm making the read operation polling every 1 sec scrolling the idx
for all the slaves.
I use maximum 3 registers per slave.

If I try the same operation for each slave one by one it works good
but when I use the for statement I got a timeout error from one
slave..
If I remove one slave from the network, the problem goes to another
slave.
Even if I poll every 10 seconds and I set the Transport.ReadTimeout to
1000 ms.

Anybody knows about the problem?

Thanks in advance..

andx

andx

unread,
Mar 12, 2010, 6:40:37 AM3/12/10
to NModbus
The problem seem to be gone after added the following row:

Following the code line:


for each idx ...
...

Threading.Thread.Sleep(10)


reg = master(idx).ReadInputRegisters(slvAdd, regAdd, tmpStr)
...
next

Any suggestion?

lil_racoon

unread,
May 3, 2010, 9:22:47 PM5/3/10
to NModbus
Hey andx,

i am also trying to do a read from the data registers but i dont get
any timout my app just gets stuck seems to be an infinite loop or
something,
can you help me out?
--
You received this message because you are subscribed to the Google Groups "NModbus" group.
To post to this group, send email to nmodbus...@googlegroups.com.
To unsubscribe from this group, send email to nmodbus-discu...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nmodbus-discuss?hl=en.

Scott Alexander

unread,
May 4, 2010, 12:41:15 PM5/4/10
to nmodbus...@googlegroups.com
Set the read and write timeouts on the Transport property of the ModbusMaster

master.Transport.ReadTimeout = master.Transport.WriteTimeout = 1000;
Reply all
Reply to author
Forward
0 new messages