Sample Modbus Code with 8051


Thread Starter


hello guys,

I have some sensor code, and I want to communicate this sensor with Modbus RTU. So I need some example code of modbus rtu with 8051 controller.

There are doubtless many other people on this forum who are willing to help, but a little more information would be most helpful. :)

For example, have you worked with Modbus comms before?

Is this sensor a serial Modbus device or does it use Modbus over Ethernet? (Or even Modbus Plus?)

Your sensor is most probably a Modbus slave device (it waits for a
valid Modbus request, then replies to the master device), but what is your master device?

What is this "8051" you're referring to? Is it the well known Intel microcontroller?

(I can help a bit with Modicon PLC code, but my knowledge of Intel assembly code is a little rusty these days. :) )

Roger V.
Hey thanks for reply,

Actually i have wind speed wind direction sensor in which siliconlab controller c8051f350 has been used. i have one terminal software in which i make a serial communication through RS485. i have made some protocol that are used for pulling a data from sensor by sending a request, and that type of code i have written in my sensor code. now i want to use addressed based Modbus rtu for pulling a data from sensor. i have to make a code with 8051 controller. and i don't know how to start...