Port of FreeModbus Libary for mbed
Page last updated
15 Apr 2010, by
Cam Marshall.
11
replies
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
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!
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
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
Hi,
have anyone implemented MODBUS TCP yet ?
Thanks,
Vatsal Shah
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
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
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.
Hi Cam!
Thanks for the modbus program!
The http://mbed.org/users/cam/programs/Modbus/5zdqv program is compiled with errors for my k64f target.
Does anyone have a solution to this problem ??
The error is: #error directive: "CMSIS Target not recognised #error: "CMSIS Target not recognised
Thanks!
Hi magnus e,
Have you tried to right click and update it?
hello cam
I was wondering if you do not have a simple example of how to use this library, since I have several doubts about it and I do not know how to proceed to implement this communication.
You need to log in to post a comment
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!