Fundamentals/RS-485 and Modbus/Modbus: the conversation
Chapter · RS-485 and Modbus

Modbus: the conversation

Who asks and who answers, what a request contains, where the data lives, the number trap in the manuals, how silence closes a frame, and what a reply, an exception and a timeout mean.

  1. 07Who asks, who answers4 minRS-485 lets any station drive the pair, so something above it has to decide who speaks. In Modbus the client asks, exactly one server answers, and a server never speaks unasked. A request that no one answers looks the same as a station that is not there.
  2. 08The fields of a request5 minA Modbus RTU request is four fields in a fixed order, address, function, data and a two byte check value. The server works the check value out again from what it received, and a request that does not match is thrown away without a word.
  3. 09Four kinds of data5 minA Modbus server keeps its data in four tables, coils, discrete inputs, input registers and holding registers. Two hold single bits and two hold 16-bit values, and which of them a request can write depends on the table, not on the server.
  4. 10The manual's number trap4 minA manual that calls the first holding register 40001 is not telling you what to put in the request. The message counts from zero, the manual counts from one, and a wrong guess often still gets an answer, only from the neighbouring register.
  5. 11Silence closes the frame5 minA Modbus RTU frame carries no length and no end marker. The receiver finds the end by listening for silence of at least three and a half character times, and a pause that long in the wrong place splits or breaks a frame.
  6. 12Reply, exception or timeout5 minA Modbus client gets one of three outcomes. A reply and an exception both prove the server heard a good frame. A timeout proves only that no valid reply came, and it has a long list of causes.

Start at 07 and read down — the order is the order things get easier in. Or take the one with your part in it; every article stands on its own, and links back to whatever it needs.