09-05-2016 04:16 AM
Hi,
I'm using this product to acquire 4 voltage with 3 different volt range (-2;2), (-5;5) and (-10;10) in Single Ended mode at the maximum frequency, which is 250kHz.
I'm using matlab with session mode to acquire the data from the DAQ. I've done some speed test on the code and I've noticed that when I require multiple samples per channel (doesn'matter if they're 10 or 20) the time to do that is over 170 milliseconds, wherease if I acquire a single sample for each channel it takes about 22 ms. I cannot use the inputSingleScan because the errors are over +- 10mV. So right now I'm acquiring 20 samples and using theit mean.
How can I reduce the time to acquire 20 samples?
Thanks in advance.
P.s. I've put the code I use, maybe it's useful for the answer.
Andrea
%Activate Daq device daqregister('ni'); daqUSB6251=daq.createSession('ni'); %Add Channels to digitalize daqUSB6251.addAnalogInputChannel('Dev1','ai0','Voltage'); %power voltage daqUSB6251.addAnalogInputChannel('Dev1','ai4','Voltage'); %Y voltage daqUSB6251.addAnalogInputChannel('Dev1','ai1','Voltage'); %X voltage daqUSB6251.addAnalogInputChannel('Dev1','ai7','Voltage'); %power meter voltage daqUSB6251.Channels(1).set('Name','Power'); daqUSB6251.Channels(2).set('Name','Y Pos'); daqUSB6251.Channels(3).set('Name','X Pos'); daqUSB6251.Channels(4).set('Name','PowerMeter'); daqUSB6251.Channels(2).set('Range',[-5.0 5.0]); %output is in [-4.5;4.5]V daqUSB6251.Channels(3).set('Range',[-5.0 5.0]); % daqUSB6251.Channels(4).set('Range',[-2.0 2.0]); daqUSB6251.NumberOfScans=20; % samples per channel daqUSB6251.Rate=250000; %Frequency of sampling in Hz daqUSB6251.Channels.set('TerminalConfig','SingleEnded'); %Voltage is referred to AiGND daqUSB6251.Channels %print the channel configuration as set above %acquire data slow (>170ms) data=daqUSB6251.startForeground(); %acquire data fast (22ms) data=daqUSB6251.inputSingleScan();