PDA

View Full Version : Libmodbus + QT



h-n-s
10th April 2013, 23:33
Hello.
I want to write an application - Modbus Slave.
The application is to have an array of data that will provide the Modbus protocol. The data for the array will fetch the object editline.
Traced libmodbus library documentation but I can not find an example.
http://manpages.ubuntu.com/manpages/precise/man7/libmodbus.7.html
Please help me.

ChrisW67
11th April 2013, 07:07
http://www.libmodbus.org/documentation

On Ubuntu the include and library files are probably in standard locations so:


LIBS += -lmodbus

in your PRO file should do.

h-n-s
11th April 2013, 21:34
I want to write a program - Modbus TCP / IP server (slave).
The program is to execute the task:
1 Take data from the array
2 Enter them in the records Holding Registers.
3 Share the Modbus protocol (to master to read them).

How to do it?
I need an example.

ChrisW67
12th April 2013, 05:24
You could read the unit tests supplied with libmodbus (https://github.com/stephane/libmodbus/tree/master/tests). There are complete client and server examples in C. Beyond that you need to ask in a libmodbus or Modbus forum because your questions have nothing to do with Qt.

h-n-s
13th April 2013, 14:21
I solved this problem. thx.

Krzysztow
10th July 2013, 13:27
Hi! If someone is interested in non-blocking modbus client using libmodbus, just recently I wrote some wrapper - https://github.com/Krzysztow/qtLibModbus .

Here the execution of requests is performed in a new thread in FIFO manner. So far some files are pulled out straight from libmodbus, but if anyone is interested, I will make it possible to link with library. If anyone has any objections regarding this piece of code, I would be more than happy to hear them.


Cheers,
Krzysztow.

dlewin
17th February 2014, 15:46
Krzysztow,

I couldn't managed to set up a project with your wrapper, I have to say that as this needs to be under windows, I couldn't also have the libmodbus compiled anyway while I have used mingw32 to do this.

ARe there guidelines to have a simple project using this please?

ChrisW67
17th February 2014, 23:15
If you have not been able to compile libmodbus on Windows then you will not be able to use Krzysztow's Qt wrapper for that library. Requirements for building libmodbus using MingW are in the libmodbus readme file: the process is very similar to a UNIX machine when the requirements are present.

rohitmbmee
28th May 2015, 14:31
Hi,

I am new to Qt and raspberry pi application development and want to use 'Modbus code provided by libmodbus' in my application to do fast development.

can any one help me how to compile c code using qt and i am using arm-linux-gnueabihf-gcc.4.6 compiler?