📄 scanproc.m
字号:
function ScanProc(BoardID,AO,AI,DIO,Hi,OutpFs,InpFs,MaxValue,RaisT,FallT,NumbLines,NumbPixels,NumbStrip,NumbSequ,OffSet,Alpha,LS,Kalman,Channel,MirrorDelay,SamplesTrigger)
% ScanProc starts the input and output porcess, adquires data to create the
% image using 'StripImageProc' callback function.
%
% Input Arguments:
% BoardID: NI board ID number
% AO: Handle to the Output device
% AI: Handle to the Input device
% DIO: Handle to the Digital Lines
% Hi: Handle to the current Image
% OutpFs: Output Sample Frequency (Hz)
% InpFs: Input Sample Frequency (Hz)
% MaxValue: Maximun Value of the Scanning Ramp (%)
% RaisT: Raising Part of the Ramp (s)
% FallT: Falling Part of the Ramp (s)
% NumbLines: Number of Lines per Image
% NumbPixsels: Number of Pixels per Line
% NumbStrip: Number of Strip per Image
% NumbSequ: Number of Images scanned
% OffSet: 1 x 2 array with the offset values for coordinate X and Y.
% Alpha: Rotation Angle (degrees). Positive angles means counterclockwise rotation.
% LS: Line Scan, 0 means Off, 1 means On
% Kalman: if 1 the filter is "off", if any integer larger than 1 it is "on"
% Channel:channels which are ON: 1=Ch1, 2=Ch2, 3=Ch1-Ch2
% MirrorDelay: delay of the mirror (s)
% SamplesTrigger: Samples adquired per trigger
%
% Output Arguments:
%
% Usage:
% ScanProc(BoardID,AO,AI,DL,Hi,OutpFs,InpFs,MaxValue,RaisT,FallT,NumbLines,NumbPixels,NumbStrip,OffSet,Alpha,LS,Kalman,SamplesTrigger);
% Create output signal to move the Mirror X and Y
Mirror=SawSignal(OutpFs,MaxValue,RaisT,FallT,NumbLines,NumbPixels,OffSet,Alpha,LS);
%--------------------------------------------------------------------------
% INPUT
%--------------------------------------------------------------------------
% Set input object properties
% Basic setup
set(AI,'SampleRate',InpFs, ...
'TriggerDelay',1/OutpFs+MirrorDelay, ...
'SamplesPerTrigger',SamplesTrigger, ...
'SamplesAcquiredFcnCount',InpFs*(RaisT+FallT)*NumbLines/NumbStrip, ...
'SamplesAcquiredFcn',{@StripImageProc2C,Hi,InpFs,RaisT,FallT,NumbLines,NumbPixels,NumbStrip,NumbSequ,Kalman,Channel});
% Set up the number of channels
if (Channel==3)|(strcmp(get(get(get(Hi,'Parent'),'Parent'),'Tag'),'ScanGUI'))
set(AI,'SamplesAcquiredFcn',{@StripImageProc2C,Hi,InpFs,RaisT,FallT,NumbLines,NumbPixels,NumbStrip,NumbSequ,Kalman,Channel});
delete(AI.Channel);
CI=addchannel(AI,0:1);
set(CI,'InputRange',[-0.5, 0.5])
else
set(AI,'SamplesAcquiredFcn',{@StripImageProc1C,Hi,InpFs,RaisT,FallT,NumbLines,NumbPixels,NumbStrip,NumbSequ,Kalman,Channel});
delete(AI.Channel);
CI=addchannel(AI,Channel-1);
set(CI,'InputRange',[-0.5, 0.5])
end
%--------------------------------------------------------------------------
% OUTPUT
%--------------------------------------------------------------------------
set(AO,'RepeatOutput',SamplesTrigger/(InpFs*(RaisT+FallT)*NumbLines)-1);
% General Porpuse Counters
if RaisT==1.7e-3
Action='Fast';
else
Action='Slow';
end
CTRSignals(BoardID,Action);
% Setup initial values for the digital IO lines
% DIO_0 High and DIO_1 (Shutter) open
putvalue(DIO.Line(1:2),logical([1 1]));
% Place the output data on the queu
putdata(AO,Mirror);
% Start the output and input process
start([AO AI]);
% Trigger the output and input process
putvalue(DIO.Line(1),logical([0]));
% Disable Counter Trigger
CTRSignals(BoardID,'Disable');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -