DAQ issue

1 次查看(过去 30 天)
otto caretta
otto caretta 2011-8-8
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 个评论
Sean de Wolski
Sean de Wolski 2011-8-8
Obvious things to check: was nidaq card plugged in/found before you started MATLAB and has it been uninterrupted since starting?

请先登录,再进行评论。

采纳的回答

Chirag Gupta
Chirag Gupta 2011-8-8
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);

更多回答(1 个)

otto caretta
otto caretta 2011-8-9
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

类别

Help CenterFile Exchange 中查找有关 Digital Input and Output 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by