Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus RTU with labview: random timeout error

Hello all,

I need to solve communication problems between a labview VI and a system (designed by my company). They are communicating on a half-duplex RS485 wire, using modbus RTU as protocol. My system is linked to my PC through an USB to RS485 adapter. I am using NI modbus library to send modbus frames with labview.

The labview VI is sending endlessly read holding registers commands to the board, and most of the time everything is working fine. But after a random amount of time, I get a timeout error (error 56) on my modbus VI. Looking at frames exchanged through RS485 port with a sniffer shows that, when everything works fine, my system is responding in less than 100 ms. And when the timeout occurs, the answer happens slightly after 100 ms. So I guessed the problem was due to timeout definition... But when I look at my VI, I see that read timeout has been set to 2 seconds, so it shall not happen!

I tried to increase the timeout value, and got the same problem. Looking at Modbus Master.lvclass:Set timeouts.vi's context help says: "This function takes effect immediately, and will change the timeouts of any future operations using the instance returned by Modbus master out", so for me the VI should not issue a timeout error less than 2 s after the sending of the last modbus frame. Right? 

Any idea of the reason of this timeout?

0 Kudos
Message 1 of 3
(2,957 Views)

Hello AinaFr,

 

Which Modbus API are you using? Could you post your code for us to take a look?

0 Kudos
Message 2 of 3
(2,925 Views)

Hello Rey,

 

I am using NI modbus library 1.2.1.42. I can not post the VI on the forum, as it contains confidential data. Can you tell me how to send you securely please?

 

Thanks in advance,

 

Aina

0 Kudos
Message 3 of 3
(2,915 Views)