Port of FreeModbus Libary for mbed

I have begun porting the FreeModbus Libary (http://freemodbus.berlios.de/) for the mbed.

So far modbus functions 3,4,6 & 10 for modbus RTU have been implemented.

Modbus


8 comments

10 Feb 2011

Hi, I was looking at this code for possible use in ModbusTCP mode. When I enable the TCP mode the compiller can't find the mbtcp.h file, it's missing from the install. Has the TCP mode been tested?

Cheer!

10 Feb 2011

G'day John,

I have not had a requirement for Modbus TCP as yet, so have never gotten around to trying to implement it.  I'm not sure that I will be having time to revisit this project any time soon.  I will be interested to hear if you are able to get TCP mode working.  Good luck!

Cheers

Cam

09 May 2011

Hi Cam,

Wondered if you'd care to share something on how do a simple "Hello World!" type of test of MODBUS RTU using your port of FreeMODBUS? Is there something on the web you can point me to help? What MODBUS testing software would you recommend? I appreciate your help.

Thanks,

Peter

09 May 2011

Hi,

have anyone implemented MODBUS TCP yet ?

 

Thanks,

Vatsal Shah

22 Jul 2011

Hi,

Still wondering if anyone has implemented MODBUS TCP using FreeMODBUS? I've tried but have been unsuccessful in getting the FreeMODBUS TCP code to compile with any of the mbed network libraries. Any hints really welcomed.

Thanks,

Peter

10 Mar 2014

Has anyone run the demo application, I'm a bit confused about the results I'm getting.

I'm using the demo as-is currently and using qmodmaster as the PC client. The demo defines 4 registers that should begin at address 1000, however the "zeroeth" register, the one that counts, is located at 999. Is there a +1 offset convention in modbus?

Also the demo doesn't seem to generate errors properly. I'm not sure how errors should be returned but accessing totally unimplimented features does error but out-of-range registers return nonsense values.

10 Mar 2014 . Edited: 10 Mar 2014

Hello Oliver,

I've not tried the demo but MODBUS does normally specify that the address for teh MODBUS access is +1 compared to the physical addess, so you'd need to ask for a read from 1001 to read registers 1000,1001,1002,1003.

This is even more confusing when you're actually looking at the MODBUS messages on the raw comms layer!

HTH

Jez

10 Mar 2014

Looks as if the library has it the other way round, it clearly adds 1 to the incoming address as I've found the "++" operation responsible. I can see how MODBUS could have a convention that "public" addresses start from 1 not 0.

I'm using QModMaster as the client and I can see from its debug output that it outputs addresses as-is, without offset. I wonder if maybe some clients don't? Maybe the convention is for the client to subtract 1, and the library is written to reverse this?

IMO the library ought to pass on the address as-is and if there is an offset it should be documented as a programming requirement.

Please log in to post a comment.