From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous AO and AI with NI USB 6001/MATLAB DAQ toolbox

Solved!
Go to solution

I am very new to data acquisition and bought an NI USB 6001 to start learning. Since I can get MATLAB free via my university, I'm using the Matlab data acquisition toolbox as the DAQ software.

My problem is that I get the following error message when I try to generate an AO signal (voltage for an LED) and measure an AI signal (voltage from a 9V battery) simultaneously.

 

Warning: This change caused queued output data to be flushed.  Use queueOutputData to queue data before starting the object.
Hardware does not support the specified connection. Check the device's user manual for valid device routes and pin-outs.

 

However measuring the AI or generating the AO each by themselves works perfectly fine.

 

My Matlab script looks like this:

 

 

daq.getDevices;

s=daq.createSession('ni');

s.Rate = 1000;

s.DurationInSeconds = 10; 

 

addAnalogInputChannel(s,'Dev1','ai0','Voltage');

addAnalogOutputChannel(s,'Dev1','ao0','Voltage');

 

aoVoltage=1.8+0.1*sin(linspace(0,2*pi,10000))';

queueOutputData(s,aoVoltage);

s

 

startBackground(s);

 

 

Note that adding the AI and AO channels to the session also works, however I get mentioned error when the session starts. Is this a limitation of my DAQ hardware (I don't see something like that mentioned in the manual) or do I have to alter the script?

The connected pins for the LED are AO0(+) and AO GND(-).

The connected pins for the battery are AI0(+) and AI4(-). (The problem is still there if I use ground reference for the AI)

0 Kudos
Message 1 of 10
(8,729 Views)
For Matlab questions, you should post to the Mathworks forum.

LabVIEW is also free for students of you change your mind and want support from NI.
0 Kudos
Message 2 of 10
(8,664 Views)
Solution
Accepted by himmellaeufer

6001 can't do simultaneous tasks.  Pretty standard limitation of the lower-end hardware.... just don't have the computational resources on the board to handle that stuff.  Even the 621x boards only have limited multitasking capability. 

 

Can either step up to a higher-end DAQ ($$$$) or buy a 2nd low-end one and synchronize tasks in software (timing's not as accurate).  I've done both approaches, which one is "best" really depends on the application.... if low cost or high performance is a priority.

Message 3 of 10
(8,653 Views)

Thanks! What would I be looking for in the product description/manual to find out if the hardware is capable of multitasking? Is this the same as multichannel or does this only refer to acqusition of the same channel type, e.g. all AO? I already tried measuring multiple AO inputs and this worked. So does this mean that I can only measure/ generate multiple signals of the same type? So generating a DO and measuring a DI simultaneously or generating a DO and measuring a AI simultaneously is not possible either?

0 Kudos
Message 4 of 10
(8,633 Views)

I have same question. Where is the simultaneous ability?

0 Kudos
Message 5 of 10
(5,833 Views)

From Mathworks:

"Tim, this does not error in MATLAB R2017b.

However NI USB-6001, NI USB-6002, NI USB-6003 do not have internal trigger signals, so the analog input and output channels will not have a hardware-synchronized start with the default configuration.

So, to have synchronized analog input and analog output channels with these device models you need to use external triggering with an external PFI terminal and addTriggerConnection."

Source: https://uk.mathworks.com/matlabcentral/answers/309786-unable-to-get-ni-usb-6002-to-generate-and-read...

0 Kudos
Message 6 of 10
(5,436 Views)

Can i read 2 Analog Inputs simultaneously? Or does the board not support it... ????

 

Any help would be really appreciated! 

0 Kudos
Message 7 of 10
(2,537 Views)

@mseth2 wrote:

Can i read 2 Analog Inputs simultaneously? Or does the board not support it... ????

 

Any help would be really appreciated! 


Simultaneously in software - yes, possible, just include both channels in the same task

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 8 of 10
(2,521 Views)

Hello, thank you for the response, I was wondering if there was a python way of doing it? I do not have any experience with LabVIEW OR matlab. Can you help? Thank you!

0 Kudos
Message 9 of 10
(2,514 Views)

@mseth2 wrote:

Hello, thank you for the response, I was wondering if there was a python way of doing it? I do not have any experience with LabVIEW OR matlab. Can you help? Thank you!


Of course, you can use the Python DAQmx drivers and there are a few examples too.

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P8o0SAC

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 10 of 10
(2,474 Views)