Fast reading and writing data via NI board
    2 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
Hi, all!
I have a question about the PCI-6229 and how manualy from MATLAB to operate the input and output analog channels. I would talk about galvo-galvo scanning.
I need to set two coordinates for mirrors (2 output channels) and get one value from photomultiplier (one input channel).
1) If I try do this directly in cicle like this:
mydaq = daq.createSession('ni');
addAnalogOutputChannel(mydaq, 'dev2', 0:1, 'Voltage');
addAnalogInputChannel(mydaq, 'dev2', 'ai0', 'Voltage');
Xmin = -5;
Xmax = 5;
Ymin = -5;
Ymax = 5;
Xresolution = 128;
Yresolution = 128;
tt = 0;
tic
for iX = Xmin : (Xmax - Xmin)/(Xresolution-1) : Xmax
    for iY = Ymin : (Ymax - Ymin)/(Yresolution-1) : Ymax
        outputSingleScan(mydaq, [iX iY]);
        PMTvalue = mydaq.inputSingleScan;
    end
end
tt = toc
I see that run time is very large:
tt =
  180.0960
It is very slow as you see. (No any two frames per second). (And we want about 30 frames per second).
2) The faster way as I find is to use queueOutputData() like that:
mydaq = daq.createSession('ni');
addAnalogOutputChannel(mydaq, 'dev2', 0:1, 'Voltage');
rate = 300e3;
mydaq.Rate = rate;
f = 30;       
duration = 10;
t = (1:(duration*rate))/rate;
outputData(:,1) = 1.9*sin(8*pi*f*t + 0*pi/2)';
outputData(:,2) = 1.9*cos(7*pi*f*t)';
queueOutputData(mydaq, outputData);
startBackground(mydaq);
But in that case we cannot put in querry reading the input data.
The question is: what is the correct and fastest workaround here?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
				Mehr zu Data Acquisition Toolbox Supported Hardware 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!
