Temperature and relay control via modbus

Thread Starter

King2

Joined Jul 17, 2022
163
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.
 

nsaspook

Joined Aug 27, 2009
16,250
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.
...
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.
The MODBUS protocol only controls bits and bytes of information from one machine to others.

What those bits and bytes 'mean' for something like a temp sensor, controller or relay, is dependent on the device 'encoding' what that data (as a register, coil, contact) 'means' as it originates from or to at the application level.

https://www.modbustools.com/modbus.html
1705514477680.png
https://www.protoconvert.com/TechnicalResourses/Tutorials/Modbus.aspx
 
Top