Implementing a Modbus Slave

M

Thread Starter

Michael Reed

I wish to implement Modbus RTU slave RS-485 on an intelligent instrument using assemble language on a 8051 or PIC processor.

I am looking for any helpful hints, application notes, sample operating systems, magazines, examples of source code, sample circuits, or good books on the subject.

I've been to Modbus.org and Modicon.com, and have a pretty good understanding of the modbus protocol, but have only found information on implementing a modbus master.

I've been looking for weeks, and am at my wit's end. Any help would be much appreciated.
 
A

Alex Pavloff

Well, you have the protocol, and, well, there's nothing magic about it. Using the serial communications functions of your processor, write some code that reads the incoming packet, checks the CRC, determines whether or not it is addressed to this slave, check the function code to see if it is valid for this slave, if it is, process the command, and then send the data back
out the port. Make sure to control the RS-485 bus when you're doing this.

That what you're going to have to do if you want to roll your own device, and its really more of an exercise in programming a PIC or 8051. If you
don't know how to program a PIC or 8051, then its a very bad idea to make this Modbus RTU slave your first project. The RTU slave isn't too complex, but there are easier ways to start off.

Alex Pavloff
Software Engineer
Eason Technology
 
A

Andrea Coccon

Well, that's more or less what I'm trying to do...
I started my first programming experience trying to create a client (a small I/O module) for a Modbus/UDP network. Now I have to implement the modbus layer.

I found your suggestion very helpful and I'd like to know if there's some tool to start developing such a system. Eg: I found a modbus server based made in VB and available as an ActiveX control, but it works on TCP. Can you tell of something else similar that can be found on the net?

Thanks,
Andrea
 
Top