Hello,
I have a project with NI USB-6003 device, where I need to acquire in continues mode Analog Inputs using EveryNSamplesEvent.
I am using Visual C++ ( Visual Studio 2013 ).
The project consists of following attached files:
- Source.cpp -> main function implementation
- IOController.cpp(h) -> declaration and implementation of IOController class
I grabbed the snipped, provided in "Cont Acq-Int Clk" example and copied into Source.cpp.
Using #if macro I branched my code in two parts:
1) NI_Example_Part - this is the code from NI Example, slightly modified to eleminate DoneEvent part.
2) MY_Example_Part - this is my code, which uses the same steps for Acquisition setup as NI_Example_Part. The difference is that I am starting in separate thread a functor object, which will setup and start acquisition.
If USE_IO_CONTROLLER is defined then the compiled code will execute MY_Example_Part, otherwise NI_Example_Part.
NI_Example_Part runs without any problems.
MY_Example_Part is setting properly the task, the channels and EveryNSample event. This part works and I checked it with the debugger. The problem is that on the first event the function DAQmxReadAnalogF64 blocks and never returns, although a time-out has been set( see "everyNCallback" function in IOController.cpp ).
I am puzzled as the implementation is exactrly the same as in NI example, but it does not work.
Could you please help?
Will appreciate any hint.
Best Regards,
Varko