10-04-2012 09:42 AM
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.
10-09-2012 10:09 AM
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:
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
10-10-2012 03:17 AM
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.
02-08-2013 10:23 AM
Updating to a current version of Matlab (2012b) seemed to solve this problem.
02-13-2013 05:30 AM
Great to hear that it's working now.
Best Regards,
Lam