DAQ issue
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Sean de Wolski
am 8 Aug. 2011
Obvious things to check: was nidaq card plugged in/found before you started MATLAB and has it been uninterrupted since starting?
Akzeptierte Antwort
Chirag Gupta
am 8 Aug. 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);
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Digital Input and Output finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!