Modbus RTU

For general discussion related FlowStone
Post Reply
Kirill
Posts: 3
Joined: Thu Sep 09, 2010 12:58 pm

Modbus RTU

Post by Kirill »

Hi folks,
I'm greatly proud that such cool software exists and has a lot of functionality. I would like to share my work of implementing Modbus Master Protocol. My implementation has only one function at the moment - Reading Input Registers, but I hope to continue development. And I think that I will continue implementation after listening your feedback. I spent a lot of time on CRC Calculation Algorithm, which is not a problem for Modbus TCP. So if you decide to develop your own Modbus, you can freely take my algorithm and make your own Components.
Attachments
Modbus_FC02.fsm
Modbus Master RTU Implementation (FC02)
(2.72 KiB) Downloaded 1513 times
Last edited by Kirill on Fri Jul 29, 2011 10:11 am, edited 1 time in total.
Embedded
Posts: 143
Joined: Sat Oct 30, 2010 1:42 pm

Re: Modbus RTU

Post by Embedded »

that's great Kirill !

Makes a nice complement to my Modbus TCP :)
Kirill
Posts: 3
Joined: Thu Sep 09, 2010 12:58 pm

Re: Modbus RTU

Post by Kirill »

That's true. Of course, these components consume some computer resources, especially when calculating CRC. Anyway Modbus very popular protocol and should be protocol #1 in such software packages.
Embedded
Posts: 143
Joined: Sat Oct 30, 2010 1:42 pm

Re: Modbus RTU

Post by Embedded »

Following your comments on CRC CPU power, I had a quick look at your CRC code. Fundamentally it was ok but there were a couple of optimisations possible.

So here's a version with a new optimised CRC decoder:
Attachments
Modbus_FC03.fsm
New CRC Calculator
(3.44 KiB) Downloaded 1524 times
Kirill
Posts: 3
Joined: Thu Sep 09, 2010 12:58 pm

Re: Modbus RTU

Post by Kirill »

Great, thanks a lot Embedded for your help! I will try to make another Modules with other Function Codes using optimised CRC.
fixstuff555
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

Re: Modbus RTU

Post by fixstuff555 »

As a side note to your Modbus RTU testing...

I used this companies gateway chip http://www.hms.se/products/abic.shtml to interface to a Profibus network on a Siemens S7-300 PLC a couple years ago. The chip interface on the microprocessor side was Modbus RTU. So theoretically, using the Modbus RTU code, along with the $80 Anybus-IC, you could talk to almost any industrial network with Flowstone.

Why is this something you may want to do? There is a boatload of used industrial PLC hardware out there for sale that can be had CHEAP (ebay, etc). An interface method to underutilized PLC hardware may be useful to someone. I've also got some code written in Picbasic if anyone is interested that may be useful along this topic as well (with CRC calculations in the messaging)
Post Reply