Test and Measurement Forum

couple seconds data capture

Post your MATLAB discussions here

couple seconds data capture

Postby zouluwei » Mon Oct 03, 2016 7:23 pm

I am using a 6404C collecting data from a photo detector. The signal is from the fluorescence sample, and the sample is moving in 'S' shape. I used to measure 100 points for each line when the sample is moving in one direction with the script as follow.
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


I'm thinking about upgrade the script to measure the whole line and chop the data into 100 pieces as 100 points for speeding up the measurement. So it means the picoscope has to capture the data for about 2-3 sceconds (the sample moves as 2.4mm/s, about 6 mm long depending on different samples ). I tried to increase the timebase using block mode, but it seems it cannot capture that long...
zouluwei
Newbie
 
Posts: 0
Joined: Mon Jun 29, 2015 6:28 pm

Re: couple seconds data capture

Postby Hitesh » Thu Oct 06, 2016 11:49 am

Hi zouluwei,

The PicoScope 6404C has an onboard buffer memory of 1 GS.

With a timebase of 2 (1.25 GS/s), this would give you 800 ms of data for a single channel.

You will have to adjust the sampling interval in order to extend the time of collection, or collect samples over a shorter period of time.

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2058
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: couple seconds data capture

Postby zouluwei » Tue Nov 01, 2016 3:18 pm

I tried to change timebase before, but it didn't work. I finally found that I have to unplug the picoscope and restart Matlab program for timebase actually changing.
zouluwei
Newbie
 
Posts: 0
Joined: Mon Jun 29, 2015 6:28 pm

Re: couple seconds data capture

Postby Hitesh » Thu Nov 03, 2016 10:02 am

Hi zouluwei,

How are you changing the timebase? You should not need to unplug and replug the device for any changes to take effect.

The timebase index for block/rapid block captures is a property of the Instrument Driver. The code below shows how to set the timebase for a 1.25 GS/s sampling rate:

Code: Select all
set(ps6000DeviceObj, 'timebase', 2);

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2058
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: couple seconds data capture

Postby zouluwei » Mon Nov 07, 2016 7:49 pm

I do use the same code as you posted. But somehow, if i don't unplug the device and restart Matlab at the same time, it doesn't effect the timebase.

And I have a very basic problem
Code: Select all
[status.getTimebase, timeIntervalNanoSeconds, maxSamples] = invoke(ps6000DeviceObj, 'ps6000GetTimebase2', 1, 0);

What does '1' represent for?
zouluwei
Newbie
 
Posts: 0
Joined: Mon Jun 29, 2015 6:28 pm

Re: couple seconds data capture

Postby Hitesh » Wed Nov 09, 2016 10:48 am

Hi zouluwei,

The number 1 in the function call is the timebase index that you are querying while 0 is the segment index. The segment index should remain zero unless you have segmented the memory.

Here's a code snippet from the Block example available via the Instrument Driver package from MATLAB Central File Exchange:

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);

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2058
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to MATLAB

Who is online

Users browsing this forum: No registered users and 0 guests