Arduino Modbus Example

Hey ! You can find something usefull about modbus and arduino. There is an example code that shows how you can try modbus algorithm with arduino. I used arduino mega in this example which means that the code only work with arduino mega. If you compile it for other types of arduino, ide probably gives some bunch of errors.

What is modbus ? Modbus is a software protocol for industrial applications. If you search on the internet a lot of plc, does not matter which brand, has a capabilitiy in talk with modbus. Or any device some solar chargers I saw or small controllers, even there some firms make modbus input output modules.

First thing to say about modbus, it is software protocol not a hardware. My some friends ask about why do we need modbus to communicate ? Answer is simple, There should be common language/protocol to talk in the world. If you produce a device and you want to go with it in the world you need to do it globally. Modbus is a global protocol. Also modbus serial communication which has checksum/CRC. You can find much information in the video.

Whatever, here is the code, I will write down simple way. If you want to change for it to for example arduino uno, you need to find the equal registers in the datasheet then change them, then it will work.

I will update the post If I find sth to say, or forget. By the way, you can just control read coil which means just go with it read digital inputs like in the video. 21/08/2016