Author Topic: How does Modbus protocol work  (Read 1788 times)

0 Members and 1 Guest are viewing this topic.

Offline King123Topic starter

  • Contributor
  • Posts: 18
  • Country: in
How does Modbus protocol work
« on: January 19, 2024, 11:49:22 am »
I'm reaching out to gain a better understanding of the Modbus protocol in a general sense. Although I haven't specified a particular microcontroller or Modbus device, let's consider a scenario.

Suppose I have a microcontroller and two Modbus devices - Device A (Relay) with an address of 0x10 and register address 0x11, and Device B (Temperature sensor) with an address of 0x20 and register address 0x21. The communication interface is RS485.

My objective is for the microcontroller to read data from the temperature sensor and control the relay using the Modbus protocol. In a basic Modbus RTU frame, there's a start bit, slave address, function code, data, CRC, and a stop bit.

Given this general situation, I'm looking a explanation of how the Modbus protocol would function to obtain temperature data and control the relay.
 

Offline gmb42

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: How does Modbus protocol work
« Reply #1 on: January 22, 2024, 11:02:52 am »
Have a look at this, explains all about Modbus protocol: https://modbus.org/docs/PI_MBUS_300.pdf
 

Online WattsThat

  • Frequent Contributor
  • **
  • Posts: 916
  • Country: us
Re: How does Modbus protocol work
« Reply #2 on: January 22, 2024, 02:15:57 pm »
Here is an easy to digest example based set of explanations (I used this as a reference when writing my own arduino library just for the experience):

https://ipc2u.com/articles/knowledge-base/modbus-rtu-made-simple-with-detailed-descriptions-and-examples/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->