Qt and National Instrument Device Drivers
-
wrote on 13 Apr 2018, 12:43 last edited by
Hey guys,
Been working to replace my LabVIEW work with Qt. Soon I am going to have to dig into the interfacing . In particular I am interested in using their GPIB board, RS232 board, and some IO boards that install right into the motherboard. I know when you install the drivers you can also install libraries for C use, but I have not been able to link them in yet and get it to compile.
I am wondering if anyone has had some experience with this, and if so I would love some tips / knowledge.
Cheers,
MrShawn -
Hey guys,
Been working to replace my LabVIEW work with Qt. Soon I am going to have to dig into the interfacing . In particular I am interested in using their GPIB board, RS232 board, and some IO boards that install right into the motherboard. I know when you install the drivers you can also install libraries for C use, but I have not been able to link them in yet and get it to compile.
I am wondering if anyone has had some experience with this, and if so I would love some tips / knowledge.
Cheers,
MrShawnHi @MrShawn,
Which platform are you on? And which compiler intend you to use?
For RS-232, you can use QSerialPort.
I have also used GPIB at work under Windows with MSVC and MinGW.
No sure which I/O boards you use and how they are controlled.Maybe you can post some more information and maybe errors you encounter so we can help you.
Regards
-
Hi
Qt is just normal c++ so nothing stops you from using C libs.
You might need to read about extern "C" and such to use them but
it Qt do not impose any restrictions versus a plain c++ project. -
Hey guys,
Been working to replace my LabVIEW work with Qt. Soon I am going to have to dig into the interfacing . In particular I am interested in using their GPIB board, RS232 board, and some IO boards that install right into the motherboard. I know when you install the drivers you can also install libraries for C use, but I have not been able to link them in yet and get it to compile.
I am wondering if anyone has had some experience with this, and if so I would love some tips / knowledge.
Cheers,
MrShawn@MrShawn said in Qt and National Instrument Device Drivers:
I know when you install the drivers you can also install libraries for C use, but I have not been able to link them in yet and get it to compile.
The process is the same for any 3rd-party library, including National Instruments ones. See :
- http://doc.qt.io/qt-5/third-party-libraries.html
- http://doc.qt.io/qtcreator/creator-project-qmake-libraries.html
I think the first link is easier to follow. The key things to add to your *.pro file are
INCLUDEPATH
andLIBS
.@aha_1980 said in Qt and National Instrument Device Drivers:
For RS-232, you can use QSerialPort.
+1
This is the easiest way to do it in Qt. No need for external libraries.
No sure which I/O boards you use and how they are controlled.
I'm guessing they are boards that use the NI DAQmx drivers. These provide C libraries.
-
wrote on 16 Apr 2018, 16:35 last edited by
I am mostly on Windows.
@aha_1980
What board do you use for GPIB?Will the QSerialPort work with the NI Serial Boards like the PCIe-8432 - this is an example of a few that I have.
If that is the case it will be really sweet, I haven't looked at the QSerialPort class but I bet it is a lot nicer than VI for the same devices....The I/O boards look like DAQmx pci boards so i should be able to follow the links showing to how bring in 3rd party libraries.
Thanks for the responses guys I'll look into some of those links.
-MrShawn
-
I am mostly on Windows.
@aha_1980
What board do you use for GPIB?Will the QSerialPort work with the NI Serial Boards like the PCIe-8432 - this is an example of a few that I have.
If that is the case it will be really sweet, I haven't looked at the QSerialPort class but I bet it is a lot nicer than VI for the same devices....The I/O boards look like DAQmx pci boards so i should be able to follow the links showing to how bring in 3rd party libraries.
Thanks for the responses guys I'll look into some of those links.
-MrShawn
@MrShawn said in Qt and National Instrument Device Drivers:
I am mostly on Windows.
Which compiler do you intend to use? I had some problem including the NI-GPIB DLL with MinGW, but finally succeeded (with help of a thread in the NI forums. With MSVC it should work out of the box.
What board do you use for GPIB?
We have PCI cards as well as the GPIB-USB-HS (which I got running with Linux-GPIB recently too).
Will the QSerialPort work with the NI Serial Boards like the PCIe-8432 - this is an example of a few that I have.
I can't tell you, I don't have these boards. If the register themselves as RS-232 (COM) port in the system, then I guess it is possible.
If that is the case it will be really sweet, I haven't looked at the QSerialPort class but I bet it is a lot nicer than VI for the same devices....
QSerialPort is just the backend for data exchange. You will have to code the UI yourself.
Regards
-
I am mostly on Windows.
@aha_1980
What board do you use for GPIB?Will the QSerialPort work with the NI Serial Boards like the PCIe-8432 - this is an example of a few that I have.
If that is the case it will be really sweet, I haven't looked at the QSerialPort class but I bet it is a lot nicer than VI for the same devices....The I/O boards look like DAQmx pci boards so i should be able to follow the links showing to how bring in 3rd party libraries.
Thanks for the responses guys I'll look into some of those links.
-MrShawn
@MrShawn said in Qt and National Instrument Device Drivers:
Will the QSerialPort work with the NI Serial Boards like the PCIe-8432
Yes.
As far as Windows is concerned, the NI board looks just like any other PCI/PCIe serial board. Your code won't know the difference between a serial port that's built directly into the motherboard, a serial port that's plugged into a PCIe slot, or a USB-to-serial converter.
I haven't looked at the QSerialPort class but I bet it is a lot nicer than VI for the same devices....
When it comes to device comms (including RS-232), I personally find VIs nicer than most (all?) C++ classes out there. See section #3.1.2. at https://forum.qt.io/topic/90276/showdown-qt-vs-labview. But, this is a matter of personal (and team/company) preference.
Note: I do find
QSerialPort
nicer thanQModbusTcpClient
, so don't let the example put you off. Try coding it in both languages yourself and then decide which you like more.