DAQ issue

3 vues (au cours des 30 derniers jours)
otto caretta
otto caretta le 8 Août 2011
hello, i have a control script for a nidaq card which has been running well untill recently but has now decided to make troubles. i am under institutional pressure to find an urgent fix... please help!
the hadrware/software is as follows:
AdaptorDllName: 'C:\Program Files\MATLAB\R2010b\toolbox\daq\daq\private\mwnidaqmx.dll' AdaptorDllVersion: '2.17 (R2010b)' AdaptorName: 'nidaq' BoardNames: {'USB-6229'} InstalledBoardIds: {'Dev1'} ObjectConstructorName: {'analoginput('nidaq','Dev1')' 'analogoutput('nidaq','Dev1')' [1x25 char]}
a simplified version of the script is:
AO=analogoutput('nidaq','Dev1'); chano=addchannel(AO,0:3); putdata(AO, [0 0 0 0]); start(AO);
the error message is:
??? To run in a hardware-clocked output mode, this hardware requires that at least 2 samples be queued using PUTDATA. You must pad your output with additional samples to use PUTDATA, or use PUTSAMPLE instead.
Error in ==> daqdevice.start at 62 start( daqgetfield(obj,'uddobject') );
obviously putsample doesnt work either and (putsample(AO, [0 0 0 0]);) produces:
??? Data must be queued using PUTDATA before starting.
Error in ==> daqdevice.start at 62 start( daqgetfield(obj,'uddobject') );
thank you very much. kind regards. otto
  1 commentaire
Sean de Wolski
Sean de Wolski le 8 Août 2011
Obvious things to check: was nidaq card plugged in/found before you started MATLAB and has it been uninterrupted since starting?

Connectez-vous pour commenter.

Réponse acceptée

Chirag Gupta
Chirag Gupta le 8 Août 2011
Couple of quick things: When you start AO, you are staring a clocked operation with this particular board based on the sample rate.
AO.SampleRate
should give you the default sample rate (number of samples outputted per sec). The default setting of the object is to run for 1 sec (duration). So when you start an AO object, the object expects samples = the (SampleRate*duration) to be already queued.
So if wish to output zeros to all the channels for the 1 second, you need queue enough data to output.
Something like this:
data = zeros(AO.SampleRate*duration, 1); % duration = 1
putdata(AO,[data data data data]);
start(AO);

Plus de réponses (1)

otto caretta
otto caretta le 9 Août 2011
chirag, thank you very much for your very useful answer. These analog outputs i use to switch on/off some equipment in the lab, and so i hadnt considered the samplerate side of things. in the past when i used a single value of putdata the signal remained constant until i putdata a different value.
i managed to achieve the same result now by setting: set (AO,'repeatoutput',1);
i never used this before so i am guessing the default value of repeatoutput must have changed in the latest release of the daq toolbox! bad boys the guys who pushed out a modified version of the default settings!!
Anyway, thank you very much for your very helpful input. kind regards otto

Catégories

En savoir plus sur Data Acquisition Toolbox Supported Hardware dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by