National Instruments USB 6002 read data in Qt Creator



  • Hello Everyone,

    I am new to Qt and Digital I/O. I want to know is it possible to read the data of National Instruments Digital I/O (USB-6002) to Qt creator windows 10/7 64 bit. If yes how can I do it.
    Please help me. Thanks in advance


  • Lifetime Qt Champion

    Hi,

    What isthat device supposed to be ?

    How is it seen by your computer ?


  • administrators

    Hi @rockon209
    The usual answer for USB devices is (as @SGaist is asking), does your computer have a driver for the device?
    If it does, then you can start looking at suitable Qt classes. If not, then you would need to develop a driver, something that is out of scope in Qt.

    From a really quick look at your device, it might be a serial device or something completely custom. Either way your computer needs a driver for it.


  • Moderators

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    I want to know is it possible to read the data of National Instruments Digital I/O (USB-6002) to Qt creator windows 10/7 64 bit. If yes how can I do it.

    Yes it's possible. Like @SGaist and @tekojo suggested, you need to install DAQmx drivers. That will give you access to the DAQmx libraries. Then, you can then write C/C++ code call the DAQmx functions.

    Here are some Qt documentation on linking your Qt-based project to external libraries:

    Here are some National Instruments documentation on DAQmx's C/C++ functions:

    I'm curious though, why did you choose Qt instead of LabVIEW to read data from the NI USB-6002?



  • Thank you for the reply @SGaist @tekojo @JKSH .

    Yes I have installed the driver of the device. It is connected to my computer with USB drive.

    @JKSH the program was already written in Qt and I want extent its function so I am using Qt and I havnt work with LabView. Qt I have worked earlier and have the basic knowledge of it.
    Is the read and write fuctions are same for C and C++ ? and where I can find the libraries of the Devices?



  • Is it possible to read the data from labview and the send the read data to Qt. As I have made the GUI in Qt?
    I am very new to NI and Qt so if the question are silly please have patience.
    Thank you.


  • Moderators

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    Is the read and write fuctions are same for C and C++ ?

    Yes. National Instruments only provided a C library; they didn't provide a C++ library. But that's OK, because C++ code can call C functions.

    where I can find the libraries of the Devices?

    See the link in my previous post: http://www.ni.com/tutorial/5409/en/

    I have DAQmx 15.1.1 in my PC, and the library is in C:\Program Files (x86)\National Instruments\NI-DAQ\DAQmx ANSI C Dev

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    Is it possible to read the data from labview and the send the read data to Qt. As I have made the GUI in Qt?

    Yes, I did that for one of my customers. But it's more complicated this way.

    Since you already have Qt experience but you don't have any LabVIEW experience, then I recommend you use the C library.

    I am very new to NI and Qt so if the question are silly please have patience.

    I think your questions are perfectly valid.



  • @JKSH Thank you But i have one Question The path that you mention for the libraries (C:\Program Files (x86)\National Instruments\NI-DAQ\DAQmx ANSI C Dev) I also have it but the folder is msvc. If i am not wrong this is for Microsoft Visual C/C++. But I am using Qt creator to build my application.So can I use the same libraries for Qt creator also?



  • I am using mingw compiler.


  • Moderators

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    but the folder is msvc. If i am not wrong this is for Microsoft Visual C/C++.

    That's correct. The library was built using Microsoft's Visual C/C++ compiler.

    But I am using Qt creator to build my application.So can I use the same libraries for Qt creator also?

    First, understand this: A compiler is a tool that takes your source code (*.cpp and *.h files) and converts them into binary files.

    Now, Qt Creator is an Integrated Development Environment (IDE). It is not a compiler. When you use Qt Creator to build a program, Qt Creator simply runs your compiler for you.

    Anyway, to answer your last question: Yes, you can use National Instruments' MSVC libraries in your project, even if you're using MinGW. That's because C libraries are compatible across different compilers on Windows. (Note: C++ libraries are different. A C++ library that is built with MSVC cannot be used in a program built with MinGW)



  • @JKSH I am searching that is it possible to use MSVC lib in MingW and I found the following post
    http://stackoverflow.com/questions/2472924/linking-to-msvc-dll-from-mingw
    and in this post says its not possible. Please have a look


  • Moderators

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    @JKSH I am searching that is it possible to use MSVC lib in MingW and I found the following post
    http://stackoverflow.com/questions/2472924/linking-to-msvc-dll-from-mingw
    and in this post says its not possible. Please have a look

    Like I said in my last post, it is not possible for C++ libraries.

    However, it is possible for C libraries.



  • ok.

    Can you give me a small example just to check the that DAQ lib is working in Mingw. Its important for me. I am not doubting your intelligence but i want to know how i can use it in a code, i havnt work on this kind of project earlier and have to idea how to do that. Pleas help.



  • NI has a lot of tutorials on how to use the DAQmx drivers.
    For example look at http://www.ni.com/tutorial/5409/en/#toc3


  • Moderators

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    Can you give me a small example just to check the that DAQ lib is working in Mingw

    To use a 3rd party library in a Qt-based project, you need to tell your *.pro file where to find the library's headers, and where to find the library's binaries.

    The simplest way is to add the paths straight into your *.pro file:

    INCLUDEPATH += "C:/Program Files (x86)/National Instruments/NI-DAQ/DAQmx ANSI C Dev/include"
    LIBS += "C:/Program Files (x86)/National Instruments/NI-DAQ/DAQmx ANSI C Dev/lib/msvc/NIDAQmx.lib"
    

    Then, in your *.cpp file, just include the library header and call its functions:

    // main.cpp
    #include <QApplication>
    #include <QWidget>
    #include <QDebug>
    
    #include <NIDAQmx.h>
    
    int main(int argc, char **argv)
    {
        // Initialize a usual Qt application
        QApplication app(argc, argv);
        QWidget w;
    
        // Initialize DAQmx and read analog input (Copied and simplified from
        // http://www.ni.com/tutorial/5409/en/#toc3 )
        TaskHandle taskHandle = 0;
        int32 samplesReceived = 0;
        float64 data[1000];
    
        DAQmxCreateTask("MyTask", &taskHandle);
        DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0", "", DAQmx_Val_Cfg_Default, -10.0, 10.0, DAQmx_Val_Volts, NULL);
        DAQmxCfgSampClkTiming(taskHandle, "", 10000.0, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 1000);
        DAQmxStartTask(taskHandle);
        DAQmxReadAnalogF64(taskHandle, 1000, 10.0, DAQmx_Val_GroupByChannel, data, 1000, &samplesReceived, NULL);
        DAQmxStopTask(taskHandle);
        DAQmxClearTask(taskHandle);
    
        // Print results
        qDebug() << "Received" << samplesReceived << "points";
        for (int i = 0; i < samplesReceived; ++i)
            qDebug() << data[i];
    
        // Run Qt event loop
        w.show();
        return app.exec();
    }
    

    The example code above does not contain any error handling. You must add it yourself.



  • thanks @sneubert

    @JKSH Thanks. I ran the code you have mentioned above, it ran successfully and got output as "Received 0 points."
    Does it means its working? I dont understand.
    I mean to say what should be the output of the code?


  • Moderators

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    I ran the code you have mentioned above, it ran successfully

    OK, that means your Qt application successfully linked to the NI DAQmx library.

    and got output as "Received 0 points."

    That means you didn't manage to acquire any data from the device.

    Modify the code to print the return value of every DAQmx* function call. The return value will be 0 if the call succeeded, or non-zero if there was an error.

    qDebug() << "Error code for DAQmxCreateTask():" << DAQmxCreateTask("MyTask", &taskHandle);
    qDebug() << "Error code for DAQmxCreateAIVoltageChan():" << DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0", "", DAQmx_Val_Cfg_Default, -10.0, 10.0, DAQmx_Val_Volts, NULL);
    ...
    

    (For example, maybe your device is not called "Dev1", so the call to DAQmxCreateAIVoltageChan failed.)

    Anyway, you now need to learn how to use the NI DAQmx library to interact with your device. That is beyond the scope of the Qt forum. I suggest you continue at the National Instruments forum: https://forums.ni.com/t5/Multifunction-DAQ/bd-p/250 Introduce yourself and say that you are trying to program DAQmx in C/C++.

    Good luck!



  • @JKSH Thank you so much for your help, it means a lot. One final question if the Qt application did not get linked to the NI DAQmx library then, i would have got the errors because of the use of various function like DAQmxCreateTask.... is it correct?


  • Moderators

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    @JKSH Thank you so much for your help, it means a lot.

    You're welcome :)

    After you create a thread in the other forum, do post a link here, so that anyone else who wants to use Qt to drive NI devices can follow your discussions.

    One final question if the Qt application did not get linked to the NI DAQmx library then, i would have got the errors because of the use of various function like DAQmxCreateTask.... is it correct?

    Correct. If your code can't link to the library, then your *.exe won't be created. MinGW will complain something like "Undefined reference to 'DAQmxCreateTask' "


  • Moderators

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    I ran the code you have mentioned above, it ran successfully and got output as "Received 0 points."
    Does it means its working? I dont understand.
    I mean to say what should be the output of the code?

    I just had a thought: Was your USB-6002 plugged into your computer when you ran the program?

    I tried it with Qt 5.6.2 (MinGW 4.9.2) + a USB-6003, and this is what I got:

    Received 1000 points
    -0.0971611
    -0.0978048
    -0.0984484
    -0.0987703
    -0.0994139
    -0.0994139
    -0.100058
    -0.100701
    -0.100701
    -0.100701
    -0.101023
    -0.101023
    -0.101345
    -0.101345
    -0.101667
    -0.101667
    -0.101989
    -0.101667
    -0.101989
    -0.101989
    -0.102632
    -0.102632
    -0.102632
    -0.102632
    -0.102954
    -0.102632
    -0.102954
    -0.102632
    -0.102954
    -0.102954
    -0.102954
    -0.103276
    -0.102632
    -0.103276
    -0.103276
    -0.103276
    -0.103276
    -0.103276
    -0.103276
    -0.10392
    -0.103598
    -0.103276
    -0.103276
    -0.103276
    -0.10392
    -0.103598
    -0.104241
    -0.103276
    -0.103276
    -0.10392
    -0.103598
    -0.103598
    -0.10392
    -0.103276
    -0.103276
    -0.103276
    -0.103276
    -0.102954
    -0.103276
    -0.102954
    -0.102632
    -0.102954
    -0.102954
    -0.102632
    -0.101989
    -0.10231
    -0.102632
    -0.101989
    -0.101667
    -0.101667
    -0.101667
    -0.101667
    -0.101667
    -0.101023
    -0.101023
    -0.101023
    -0.101023
    -0.100701
    -0.100701
    -0.100379
    -0.100701
    -0.100701
    -0.101023
    -0.100701
    -0.100701
    -0.100379
    -0.100701
    -0.100379
    -0.100701
    -0.100379
    -0.100701
    -0.100701
    -0.100701
    -0.100701
    -0.100701
    -0.100701
    -0.100379
    -0.100701
    -0.100701
    -0.100701
    -0.100701
    -0.100701
    -0.101023
    -0.100701
    -0.100379
    -0.101667
    -0.100379
    -0.100701
    -0.101023
    -0.100701
    -0.101023
    -0.101667
    -0.101345
    -0.101667
    -0.101667
    -0.101345
    -0.101989
    -0.101989
    -0.101989
    -0.10231
    -0.101989
    -0.10231
    -0.102954
    -0.102954
    -0.102954
    -0.102954
    -0.103276
    -0.102954
    -0.102954
    -0.103276
    -0.103276
    -0.10392
    -0.10392
    -0.104563
    -0.104563
    -0.104241
    -0.104563
    -0.10392
    -0.10392
    -0.104563
    -0.104563
    -0.104885
    -0.104885
    -0.104885
    -0.105207
    -0.105529
    -0.105207
    -0.104885
    -0.105529
    -0.105207
    -0.105851
    -0.105529
    -0.105851
    -0.105529
    -0.105851
    -0.106494
    -0.106494
    -0.106494
    -0.106494
    -0.106816
    -0.106816
    -0.10746
    -0.107781
    -0.107138
    -0.108103
    -0.108425
    -0.108425
    -0.108425
    -0.109069
    -0.109069
    -0.109391
    -0.109712
    -0.110034
    -0.110034
    -0.109712
    -0.110678
    -0.110678
    -0.110678
    -0.111
    -0.111322
    -0.111
    -0.111322
    -0.111322
    -0.111322
    -0.111322
    -0.111643
    -0.111965
    -0.112287
    -0.111965
    -0.111965
    -0.111965
    -0.112287
    -0.111643
    -0.111965
    -0.112287
    -0.112609
    -0.112609
    -0.112287
    -0.112609
    -0.112931
    -0.112931
    -0.112931
    -0.112931
    -0.112931
    -0.113896
    -0.112931
    -0.112931
    -0.112931
    -0.112609
    -0.112931
    -0.113253
    -0.112931
    -0.112931
    -0.112931
    -0.112609
    -0.112931
    -0.113253
    -0.113253
    -0.113574
    -0.113253
    -0.113253
    -0.113253
    -0.113896
    -0.113574
    -0.113253
    -0.113574
    -0.113253
    -0.113253
    -0.113253
    -0.113253
    -0.113574
    -0.113896
    -0.112931
    -0.113253
    -0.113253
    -0.113574
    -0.113574
    -0.113253
    -0.113574
    -0.113574
    -0.113253
    -0.113253
    -0.113574
    -0.112609
    -0.112931
    -0.113253
    -0.113253
    -0.112609
    -0.112931
    -0.112609
    -0.113253
    -0.112931
    -0.112287
    -0.112931
    -0.112609
    -0.111965
    -0.111643
    -0.111643
    -0.111965
    -0.111643
    -0.111322
    -0.111643
    -0.111
    -0.111322
    -0.111
    -0.110678
    -0.111
    -0.110678
    -0.110034
    -0.110034
    -0.109712
    -0.109712
    -0.109712
    -0.109069
    -0.109069
    -0.109069
    -0.108747
    -0.108747
    -0.108747
    -0.108103
    -0.108103
    -0.108103
    -0.107781
    -0.108103
    -0.108103
    -0.10746
    -0.107781
    -0.10746
    -0.108425
    -0.10746
    -0.108103
    -0.108103
    -0.107781
    -0.108103
    -0.107781
    -0.108103
    -0.108425
    -0.108103
    -0.108103
    -0.108103
    -0.10746
    -0.10746
    -0.107781
    -0.108103
    -0.108103
    -0.107781
    -0.10746
    -0.108425
    -0.108425
    -0.108103
    -0.108103
    -0.108425
    -0.108425
    -0.108747
    -0.108103
    -0.108747
    -0.109069
    -0.109069
    -0.109069
    -0.109391
    -0.109069
    -0.109069
    -0.108747
    -0.109069
    -0.109712
    -0.109391
    -0.109391
    -0.109712
    -0.109712
    -0.110356
    -0.109391
    -0.110034
    -0.110356
    -0.110034
    -0.110034
    -0.110034
    -0.110678
    -0.110356
    -0.110678
    -0.111
    -0.110678
    -0.110356
    -0.110678
    -0.110678
    -0.110678
    -0.111322
    -0.111322
    -0.111965
    -0.111643
    -0.111965
    -0.111322
    -0.111965
    -0.111965
    -0.111965
    -0.112287
    -0.112287
    -0.112609
    -0.112609
    -0.112931
    -0.112931
    -0.112609
    -0.113253
    -0.113896
    -0.113253
    -0.113896
    -0.114218
    -0.114862
    -0.114218
    -0.11454
    -0.114862
    -0.115505
    -0.115505
    -0.115505
    -0.116149
    -0.116149
    -0.116793
    -0.117115
    -0.116471
    -0.116793
    -0.116471
    -0.116793
    -0.117115
    -0.116793
    -0.117115
    -0.117115
    -0.117115
    -0.117436
    -0.117436
    -0.117436
    -0.117436
    -0.117758
    -0.117436
    -0.117758
    -0.117758
    -0.11808
    -0.118402
    -0.117758
    -0.117115
    -0.117758
    -0.117758
    -0.117758
    -0.117436
    -0.118402
    -0.11808
    -0.118724
    -0.118402
    -0.118402
    -0.118402
    -0.11808
    -0.118402
    -0.11808
    -0.11808
    -0.118402
    -0.11808
    -0.11808
    -0.11808
    -0.118402
    -0.118724
    -0.118402
    -0.117758
    -0.117758
    -0.117758
    -0.11808
    -0.117115
    -0.117758
    -0.11808
    -0.117758
    -0.117758
    -0.118402
    -0.118402
    -0.117758
    -0.117758
    -0.118402
    -0.118724
    -0.118402
    -0.11808
    -0.11808
    -0.117758
    -0.118402
    -0.117758
    -0.117758
    -0.11808
    -0.11808
    -0.117436
    -0.117758
    -0.11808
    -0.117436
    -0.117436
    -0.117436
    -0.117436
    -0.117115
    -0.117758
    -0.117436
    -0.117115
    -0.116793
    -0.117115
    -0.116471
    -0.116471
    -0.116471
    -0.116149
    -0.115827
    -0.115827
    -0.115505
    -0.115505
    -0.115505
    -0.114862
    -0.115184
    -0.114862
    -0.115184
    -0.114218
    -0.114218
    -0.113896
    -0.113896
    -0.113253
    -0.113574
    -0.113574
    -0.113574
    -0.113253
    -0.112931
    -0.113253
    -0.112931
    -0.112931
    -0.112287
    -0.112609
    -0.112609
    -0.112609
    -0.112609
    -0.112287
    -0.111965
    -0.112287
    -0.112287
    -0.112609
    -0.112609
    -0.112609
    -0.111965
    -0.111965
    -0.112287
    -0.111643
    -0.112287
    -0.112287
    -0.111322
    -0.111643
    -0.111643
    -0.111965
    -0.112287
    -0.111322
    -0.111965
    -0.111965
    -0.111965
    -0.112287
    -0.111965
    -0.112609
    -0.112287
    -0.111965
    -0.112287
    -0.112609
    -0.112609
    -0.112287
    -0.112609
    -0.112287
    -0.112609
    -0.112931
    -0.112931
    -0.112931
    -0.113253
    -0.113574
    -0.113253
    -0.113574
    -0.113574
    -0.113253
    -0.113253
    -0.113574
    -0.113896
    -0.113574
    -0.113574
    -0.113896
    -0.114218
    -0.11454
    -0.11454
    -0.11454
    -0.114218
    -0.11454
    -0.11454
    -0.11454
    -0.114218
    -0.11454
    -0.115505
    -0.114862
    -0.114862
    -0.115505
    -0.115505
    -0.115184
    -0.115505
    -0.115505
    -0.116149
    -0.115827
    -0.116149
    -0.116471
    -0.116149
    -0.116471
    -0.116793
    -0.116793
    -0.117115
    -0.117436
    -0.117758
    -0.117436
    -0.117758
    -0.118402
    -0.118402
    -0.118724
    -0.118724
    -0.118402
    -0.118724
    -0.118724
    -0.119367
    -0.119367
    -0.119046
    -0.119367
    -0.119689
    -0.120011
    -0.120011
    -0.120333
    -0.120655
    -0.120011
    -0.120333
    -0.120333
    -0.120655
    -0.120976
    -0.120976
    -0.120976
    -0.120976
    -0.120976
    -0.120976
    -0.12162
    -0.12162
    -0.12162
    -0.121298
    -0.121298
    -0.120976
    -0.121942
    -0.12162
    -0.12162
    -0.12162
    -0.12162
    -0.120976
    -0.121298
    -0.121298
    -0.121942
    -0.121942
    -0.121942
    -0.121942
    -0.121942
    -0.12162
    -0.121942
    -0.121942
    -0.122264
    -0.122264
    -0.121298
    -0.121298
    -0.121942
    -0.121298
    -0.121942
    -0.121942
    -0.12162
    -0.121298
    -0.12162
    -0.121298
    -0.12162
    -0.12162
    -0.121942
    -0.12162
    -0.12162
    -0.121298
    -0.120976
    -0.121298
    -0.12162
    -0.121298
    -0.120976
    -0.121298
    -0.121298
    -0.121298
    -0.121298
    -0.121298
    -0.121298
    -0.120976
    -0.120976
    -0.120976
    -0.120976
    -0.121298
    -0.120655
    -0.120333
    -0.120333
    -0.120333
    -0.120011
    -0.120011
    -0.120333
    -0.119367
    -0.119367
    -0.119689
    -0.118724
    -0.119046
    -0.118724
    -0.118402
    -0.118402
    -0.118724
    -0.118402
    -0.118402
    -0.11808
    -0.117758
    -0.117758
    -0.117758
    -0.117436
    -0.117436
    -0.117115
    -0.116793
    -0.116149
    -0.116149
    -0.116471
    -0.115827
    -0.115505
    -0.116149
    -0.116149
    -0.116149
    -0.116149
    -0.115827
    -0.116149
    -0.115827
    -0.115184
    -0.115505
    -0.115184
    -0.115827
    -0.115827
    -0.116149
    -0.115827
    -0.115505
    -0.115827
    -0.115505
    -0.115827
    -0.115184
    -0.115184
    -0.115505
    -0.115505
    -0.115505
    -0.115184
    -0.115184
    -0.115184
    -0.114862
    -0.115505
    -0.114862
    -0.114862
    -0.115184
    -0.115505
    -0.115184
    -0.115184
    -0.115505
    -0.115184
    -0.115184
    -0.115505
    -0.115827
    -0.116149
    -0.115827
    -0.116471
    -0.116471
    -0.115827
    -0.116471
    -0.116471
    -0.116471
    -0.116793
    -0.116471
    -0.117115
    -0.117115
    -0.117115
    -0.117758
    -0.117115
    -0.117115
    -0.117115
    -0.117115
    -0.117115
    -0.117436
    -0.117436
    -0.117758
    -0.11808
    -0.117758
    -0.118402
    -0.117758
    -0.118402
    -0.118402
    -0.117758
    -0.11808
    -0.118402
    -0.118402
    -0.11808
    -0.118724
    -0.119046
    -0.119046
    -0.119046
    -0.119367
    -0.119046
    -0.119367
    -0.119689
    -0.120011
    -0.120011
    -0.120655
    -0.120655
    -0.120655
    -0.120333
    -0.120655
    -0.120976
    -0.12162
    -0.12162
    -0.12162
    -0.121942
    -0.121942
    -0.122264
    -0.121942
    -0.122586
    -0.122586
    -0.122264
    -0.123229
    -0.123229
    -0.123229
    -0.122907
    -0.123873
    -0.123551
    -0.123873
    -0.123551
    -0.123551
    -0.123551
    -0.123873
    -0.123873
    -0.123551
    -0.123873
    -0.123873
    -0.124517
    -0.12516
    -0.124195
    -0.124195
    -0.124195
    -0.124517
    -0.124838
    -0.124517
    -0.124517
    -0.124838
    -0.124517
    -0.124838
    -0.124838
    -0.124517
    -0.124838
    -0.124517
    -0.124517
    -0.124195
    -0.124517
    -0.124517
    -0.124517
    -0.124517
    -0.124838
    -0.124517
    -0.124517
    -0.124195
    -0.124195
    -0.124517
    -0.124517
    -0.124195
    -0.124838
    -0.124517
    -0.124517
    -0.123873
    -0.123551
    -0.124195
    -0.123873
    -0.123873
    -0.123551
    -0.124195
    -0.123873
    -0.123873
    -0.123873
    -0.123873
    -0.123873
    -0.123551
    -0.123873
    -0.123229
    -0.123551
    -0.123229
    -0.123551
    -0.123551
    -0.123551
    -0.122586
    -0.122907
    -0.122907
    -0.122907
    -0.122907
    -0.122907
    -0.122907
    -0.122264
    -0.122264
    -0.122586
    -0.121942
    -0.12162
    -0.121942
    -0.12162
    -0.12162
    -0.121298
    -0.120976
    -0.120655
    -0.120655
    -0.120976
    -0.120333
    -0.120655
    -0.120333
    -0.119689
    -0.119689
    -0.119689
    -0.119689
    -0.119367
    -0.119046
    -0.118724
    -0.118724
    -0.118402
    -0.119046
    -0.118402
    -0.118724
    -0.117758
    -0.117758
    -0.11808
    -0.11808
    -0.117758
    -0.117436
    -0.117758
    -0.117436
    -0.117115
    -0.117436
    -0.117115
    -0.117115
    -0.117436
    -0.117115
    -0.117115
    -0.117436
    -0.117758
    -0.117436
    -0.117115
    -0.117758
    -0.117436
    -0.117436
    -0.117758
    -0.117115
    -0.117115
    -0.117758
    -0.117758
    -0.117436
    -0.117115
    -0.117436
    -0.117758
    -0.117436
    -0.117436
    -0.117758
    -0.11808
    -0.118402
    -0.11808
    -0.117758
    -0.117758
    -0.118724
    -0.11808
    -0.118402
    -0.118402
    -0.118402
    -0.118402
    -0.118402
    -0.118724
    -0.119046
    -0.118724
    -0.119046
    -0.119046
    -0.119046
    -0.119046
    -0.118724
    -0.119367
    -0.119689
    -0.120011
    -0.119367
    -0.119689
    -0.119689
    -0.119689
    -0.119689
    -0.120011
    -0.120011
    -0.120011
    -0.120333
    -0.120333
    -0.120976
    -0.120976
    -0.120655
    -0.120333
    -0.121298
    -0.120655
    -0.120976
    -0.12162
    -0.12162
    -0.12162
    -0.121298
    -0.121942
    -0.12162
    -0.122264
    -0.122907
    -0.122586
    -0.122907
    -0.122586
    -0.122907
    -0.122907
    -0.122907
    -0.123551
    -0.123873
    -0.123873
    -0.123873
    -0.123873
    -0.124195
    -0.124838
    -0.124838
    -0.124517
    -0.124517
    -0.124838
    -0.124838
    -0.12516
    -0.125482
    -0.125482
    -0.12516
    -0.125804
    -0.125804
    -0.125804
    -0.126126
    -0.125482
    -0.125482
    -0.125804
    -0.126126
    -0.125804
    -0.125804
    -0.126448
    -0.126769
    -0.126126
    -0.126126
    -0.126448
    

    It's reading around 0 volts because I didn't connect any input signals.



  • @JKSH Yes the device is plugged into the computer. But when i see in the NI Measurement and automation explorer its not detected. I read some where if you have USB3.0 drivers then its not detecting the earlier format devices (even it is connected to USB1.0 or USB 2.0) not sure though what is the problem.
    I got this

    Received 0 points
    Error code for DAQmxCreateTask(): 0
    Error code for DAQmxCreateAIVoltageChan(): -88302
    Error code for DAQmxCfgSampClkTiming(): -200477
    Error code for DAQmxStartTask(): -200478
    Error code for DAQmxReadAnalogF64(): -200478
    Error code for DAQmxStopTask(): 0
    Error code for DAQmxClearTask (): 0


  • Moderators

    @rockon209 said in National Instruments USB 6002 read data in Qt Creator:

    @JKSH Yes the device is plugged into the computer. But when i see in the NI Measurement and automation explorer its not detected. I read some where if you have USB3.0 drivers then its not detecting the earlier format devices (even it is connected to USB1.0 or USB 2.0) not sure though what is the problem.
    ...
    Error code for DAQmxCreateAIVoltageChan(): -88302

    Error -88302 seems to be related to driver problems: http://digital.ni.com/public.nsf/allkb/19E7993CF8366EED8625764200771C68?OpenDocument

    Anyway, your issue is definitely under National Instruments territory. I suggest you re-install your DAQmx drivers (preferably the latest version), and if you're still having issues, ask at the NI forum.

    Error code for DAQmxCfgSampClkTiming(): -200477
    Error code for DAQmxStartTask(): -200478
    Error code for DAQmxReadAnalogF64(): -200478

    See http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/01d50d3f86ee67d8862576cf00745e78/$FILE/NI-DAQmxErrorCodes.PDF -- Errors -200477 and -200478 mean that DAQmx is complaining that you have no devices or channels.

    Once you fix error -88302, these should go away.

    (Final note: Since you are getting meaningful error codes from the DAQmx functions, this is further proof that your Qt application has successfully linked to the DAQmx library)



  • @JKSH It was the problem with NI software and uninstall the full software and install it again and now it works.
    I have one more question i want to read the digital Input signal and i am using "DAQmxReadDigitalU16" function to read but i am not getting the ouput
    i am getting following error:-
    The program has unexpectedly finished.



  • NO worries all good.



  • @JKSH
    Hello JKSH as the code above mentioned i can get 1000 sample points when i run the code but if i want to read and store continuously the data from a port of the device how i can do it. Can you please helm me in this?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.