Modbus slave behavior

A

Thread Starter

Anonymous

Hi,

I'm new to Modbus, can someone help to answer the question below?

If modbus slave receives the second request before it sends reply for the first request, what will modbus slave do? will it sends two replies (reply1, reply2), or it only sends reply for request 2?
 
With the Modbus Network, there should be one master, and up to 247 slaves. The master will initiate a query to a slave and wait for a response. If no response from the slave is received within a timout period, the master will abort the current query and get the next message query to transmit.

A master should not transmit another query until it has either received a response from the slave, or the message has timed out. If the slave cannot respond within the timeout period, it should not send a response.
 
The main thing you should know is that the Modbus master should only issue a second request either after a timeout, or after a response (be it successfully or not). So, it sounds like your master device should up its response timeout.

No telling what the slave device will do, as it all depends on how the slave manufactured coded their Modbus driver, whether it can buffer incoming commands, etc. I would suspect it will choke on the second request.

CH
 
J

Jerry Miille

Excellent question! Going to be interesting to see the responses to this message.

In theory this should not happen but in the real world, it can, and it does all the time.

The answer for you is that the slave should respond to all VALID messages in the order that they arrive. I am defining VALID here as a message that has a good CRC or BCH AND is addressed to the remote (broadcast messages do not get a response anyway). The Slave should never throw a valid messages away, ever. Just take the Master messages in one at a time, process them and return the answer. This is not a slave problem. A slave should always answer a valid message in the order it was received. The slave has no control over anything. It can only respond when spoken to and that is that.

This a Master problem and it can lead to all sorts of problems.

Jerry Miille
 
Just a curiosity: Does this behavior happen/apply to Modbus RTU or is the same for Modbus Plus & Modbus TCP/IP?

Regards.
 
I think the previous question was regarding the capacity of Master to send/initiate several queries at the same time to a slave (without waiting for previous response) by using Modbus Plus or TCP and not about the number of Masters allowed.

Is it right or not?

I want to know this interesting feature/answer too!
 
Communication timeout is not something specific to Modbus alone. This is inherent to every communication technology inevented so far including TCP/IP and human communication. Also, every communication protocol is basically a query and answer dialogue phenomenon. So if there is a timeout,the other guy has to retry few more times before declaring communication failure.
 
Top