Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI USB 6229 and Matlab: "Hardware does not support sample rate"

While using a NI USB 6229 with Matlabs DAQ toolboxI encountered the follwing problem. When executing the following code:

 

aOut=analogoutput('nidaq', 'dev1');
aOutChannel = addchannel(aOut,[0:3]); 

 I receive the following error message in about 20% of the times:

 

Warning: This hardware could not support the requested value of 1000.00 for SampleRate.
SampleRate has been set to 0.00. 
> In daqdevice.addchannel at 209

However, 1000 Hz is the default sampling rate for this device.

 

Some observations:

- This error appears only to happen if I add 4 output lines, but not if I add less lines.

- It does not make a difference if I set those 4 lines in one call to addlines() or in separate calls.

- It does not matter whether I set the sampling rate via set(aOut, 'samplerate', 1000) before I add the lines.

- It does not matter whether a device is actually plugged to the analog output ports or not.

 

I would be grateful for any ideas on how to track down this error message.

 

 

0 Kudos
Message 1 of 5
(4,164 Views)

Hello,

 

I haven't used the Matlab DAQ Toolbox so far, so I have no clue how Mathworks implemented the Driver access. Since I have no access to Matlab + Toolboxes, I created an output with the same setup using LabVIEW + USB 6229:

 

Output Channels: ao0:3

Samplingrate: 1000

Blocksize: 1000

Sample mode: continous

 

I had no problems, even not when increasing the sampling rate. Thats not surprising, since the 6229 supports up to 833 kS/s when using the analog output.

 

Since that configuration worked fine in LabVIEW I searched for the error in Matlab. It seems, that the "This hardware could not support..." error appears when the value doesn't match the allowed Sample rate (according to the Base time clock divider on the Board) and resets the value to the next appropriate value. Strange thing is that you only receive this message in 20% of the execution times. 

 

Since the Hardware can handle 1000 S/s on 4 channels easily, I guess that the toolbox got some issue communicating with the DAQmx drivers.

 

Instead of using the DAQ Toolbox you could try to access the DAQ driver directly in Matlab using the Driver DLL. Here's a description which I think is usefull to get it running:

 

Use DAQmx in Matlab

 

You could also try to get some information in the mathworks forum. They should know the limitations on accessing Hardware when using their toolbox. 

 

Best regards,

Lam

Message 2 of 5
(4,117 Views)

HI LamD.,

many thanks for the reply. I will look at the resources you linked to. Maybe accessing the drivers directly is indeed the solution.

0 Kudos
Message 3 of 5
(4,103 Views)

Updating to a current version of Matlab (2012b) seemed to solve this problem.

0 Kudos
Message 4 of 5
(3,937 Views)

Great to hear that it's working now. 

 

Best Regards,

Lam

0 Kudos
Message 5 of 5
(3,916 Views)