PDA

View Full Version : QT and USB Modbus comunication



hruodbert
8th September 2010, 11:33
Hello,
I'm a new QT user and I want to implement a comunication from QT to Arduino.

I want to use a USB-Modbus protocol. Currently I use the Qt 4.7 for Windows but in documentation I not have read any class to perform that comunication.
In this forum I've read a old thread that resolve my problem (http://www.qtcentre.org/threads/11182-Modbus-QextSerialPort-and-QTimer) but in the new documentation (QT 4.7) there isn't the implementation of QextSerialPort class.
Do you have some idea to resolve my problem?

Thanks

Roberto

tbscope
8th September 2010, 11:38
QExtSerialPort is not intended for USB.

You need a driver that exposes an api that you can use to get the data from the USB port
Any website about hobby electronics probably has a link to such a driver.

Then you need to use that api and implement the modbus protocol.

hruodbert
8th September 2010, 11:49
Thank for your reply :)

But I want put the data on USB port. I do use a driver that exposes an api also for put the data or that solution it's valid only for get the data from the USB port?

tbscope
8th September 2010, 11:55
I guess most drivers can send and receive.
http://sourceforge.net/apps/trac/libusb-win32/wiki

You can also buy ready made solutions (read: a modbus driver)

marcvanriet
8th September 2010, 13:32
Hello,

Modbus is just a serial protocol using RS485 (something similar to the RS232 port on your desktop computer).

You can use QExtSerialport (it's on sourceforge I think) for the serial communication.

You can use an USB-to-RS485 convertor to communicate on the RS485 bus (you can buy it on Newark or Digikey or in your computer shop).
This kind of converter acts like a serial port, so you don't have to know anything about USB.

And then you have to implement the Modbus protocol (that is, send the correct data packets on the bus and handle the incoming data packets).
I believe there is an open-source implementation of Modbus that can get you started for implementing the protocol.

If you get this to work, give me a signal. I can use it too :)

Best regards,
Marc

HM
27th August 2011, 08:48
Have a look at pvbrowser http://pvbrowser.de/pvbrowser/index.php - They have implemented Modbus RTU via USB and other protocolls.