LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Separate Task for DAQmx for 2 devices?

Hi all,

 

Im new to CVI.

Lets say I have a DAQ USB 6343 and I create a simulated USB 6341 device.

When I click on start button, it will acquire all analog i/p for both devices and display on the indicator.

 

For 1 device, it works well. But when I try to create a separate taskhandle to acquire analog i/p for the simulated device, I got an error:

 

NON-FATAL RUN-TIME ERROR:   "DAQ.c", line 433, col 18, thread id 0x00001E98:   Function DAQmxReadAnalogF64: (return value == -200278 [0xfffcf1aa]). Attempted to read a sample beyond the final sample acquired. The acquisition has stopped, therefore the sample specified by the combination of position and offset will never be available.  Specify a position and offset which selects a sample up to, but not beyond, the final sample acquired. The final sample acquired can be determined by querying the total samples acquired after an acquisition has stopped. Attempted to Read Sample: 100 Property: DAQmx_Read_RelativeTo Corresponding Value: DAQmx_Val_CurrReadPos Property: DAQmx_Read_Offset Corresponding Value: 0  Task Name: DAQTaskInProject6341  Status Code: -200278

 

For first task:

         DAQmxReadAnalogF64 (taskHandleAI, samplesToReadPerChannel, 10.0,
         DAQmx_Val_GroupByChannel, data,
         numChannels*samplesToReadPerChannel, &actualSamplesRead, 0);

 

For second task:

         DAQmxReadAnalogF64 (taskHandleAI6341, samplesToReadPerChannel, 10.0,
         DAQmx_Val_GroupByChannel, data6341,
         numChannels6341*samplesToReadPerChannel, &actualSamplesRead6341, 0);

 

Can anyone enlighten me what is the correct way to do this? 

0 Kudos
Message 1 of 3
(3,944 Views)

This is roughly how I tried.

 

I created another DAQProjecttask and taskhandle for the simulated daq to acquire analog input.

For e.g, case 0 will call the DAQmxReadAnalogF64F with the 6343 taskhandle.

Followed by case 1,  with the similar approach, call the DAQmxReadAnalogF64 with the simulated 6341 taskhandle.

This will continue until stop button is press.

 

Unfortunately this does not works. The same error occur when trying to perform the read.

 

I wonder is this the correct way to do it?

Anyone?

0 Kudos
Message 2 of 3
(3,928 Views)

Simulated devices should behave as actual hardware devices, with the unique caveat that channels from a simulated board cannot be mixed in a single task with those of a real board.

I wonder what happens if you start only the simulated device task: if you still get the error you should recheck your code and maybe compare it with some DAQmx example you can find on your PC (use the example finder to find one similar to your situation, e.g. ContAcq-ExtClk-DigStart.prj).

You could also post here all the code for the daqmx task, from setting to acquisition, so that we can check it.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 3
(3,914 Views)