PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
Pico.TriggerChannel = 1;
Pico.TriggerThreshold = 0;
Pico.PostTriggerSamples = 2e5;
Pico.TimeBase=2;
triggerGroupObj = get(ps6000DeviceObj, 'Trigger');
triggerGroupObj = triggerGroupObj(1);
[status.SimpleTrigger] = invoke(triggerGroupObj, 'setSimpleTrigger', Pico.TriggerChannel, Pico.TriggerThreshold, 2);
for ix=0:(a-1)
if mod(ix,2)==0
MoveStageTo(sx+ix*step,sy+b*step-step)
else
MoveStageTo(sx+ix*step,sy)
end
for iy=0:(b-1)
nmea=nmea+1;
ChA(:,1)={zeros(Pico.PostTriggerSamples,numFreq)};
ChB(:,1)={zeros(Pico.PostTriggerSamples,numFreq)};
ffttemp.a=0; ffttemp.b=0; ffttemp.phi=0;
fftresult(:,nmea)={repmat(ffttemp,numFreq,1)};
[ChA(:,1), ChB(:,1)]=Sampling_Scan(ntimes, numSample,zerooffset);
[fftresult(:,nmea),~]=TriggerFFT(ChA(1,:), ChB(1,:), timeInt, LED_Freq, nFFTSample, Sample_tr);
end
pause(1)
if mod(ix,2)==0
MoveStageTo(sx+ix*step+step,sy+b*step-step)
else
MoveStageTo(sx+ix*step+step,sy)
end
pause(1)
end
Code: Select all
function [ChA, ChB]=Sampling_Scan(ntimes,numSample, zerooffset)
global blockGroupObj
ChA=cell(1,1);
ChA{1}=zeros(numSample,ntimes);
ChB=ChA;
for iTimes=1:ntimes
[status.runBlock] = invoke(blockGroupObj, 'runBlock', 0);
[~, ~, ChA{1}(:,iTimes), ChB{1}(:,iTimes)] = invoke(blockGroupObj, 'getBlockData', 0, 0, 1, 0);
ChA{1}(:,iTimes)=ChA{1}(:,iTimes)-zerooffset;
end
end
Code: Select all
set(ps6000DeviceObj, 'timebase', 2);
Code: Select all
[status.getTimebase, timeIntervalNanoSeconds, maxSamples] = invoke(ps6000DeviceObj, 'ps6000GetTimebase2', 1, 0);
Code: Select all
%% Verify Timebase Index and Maximum Number of Samples
% Driver default timebase index used - use ps6000GetTimebase2 to query the
% driver as to suitability of using a particular timebase index and the
% maximum number of samples available in the segment selected (the buffer
% memory has not been segmented in this example) then set the 'timebase'
% property if required.
%
% To use the fastest sampling interval possible, set one analogue channel
% and turn off all other channels.
%
% Use a while loop to query the function until the status indicates that a
% valid timebase index has been selected. In this example, the timebase
% index of 161 is valid.
% Initial call to ps6000GetTimebase2 with parameters:
% timebase : 161
% segment index : 0
status.getTimebase2 = PicoStatus.PICO_INVALID_TIMEBASE;
timebaseIndex = get(ps6000DeviceObj, 'timebase');
while(status.getTimebase2 == PicoStatus.PICO_INVALID_TIMEBASE)
[status.getTimebase2, timeIntervalNanoSeconds, maxSamples] = invoke(ps6000DeviceObj, 'ps6000GetTimebase2', timebaseIndex, 0);
if(status.getTimebase2 == PicoStatus.PICO_OK)
break;
else
timebaseIndex = timebaseIndex + 1;
end
end
set(ps6000DeviceObj, 'timebase', timebaseIndex);