How can I reduce time between block measuerements?

Post your MATLAB discussions here
Post Reply
joshctaylor
Newbie
Posts: 0
Joined: Tue Jul 16, 2019 5:44 pm

How can I reduce time between block measuerements?

Post by joshctaylor » Fri Dec 27, 2019 4:04 pm

Hi all,

I'm capturing data on 2 channels using the 3403D andI need to capture many blocks of data (10,000) at 500MS/s (time divider 2). I'm using block transfer in MATLAB. I'm also using the signal generator in the same session.

My problem is when I collect the block there is around 1-2 sec of waiting for the scope to become available. Does anyone know how to reduce the time between captureing blocks - the documentation suggests 80mS should be possible.

I'm using this code to collect the block.

Code: Select all

[status.runBlock] = invoke(blockObj, 'runBlock', 0); %% move this outside loop
[numSamples, overflow, chA, chB, chC, chD] = invoke(blockObj, 'getBlockData', 0, 0, 1, 0);
I considered using the rapid block to collect the data. Is there a way to run matlab code between the blocks so I can control the hardware under test? My code in context is below.

Many thanks

Code: Select all

PS3000aConfig;
ps3000aDeviceObj = icdevice('picotech_ps3000a_generic.mdd', '');
connect(ps3000aDeviceObj)

% Set input Channels - turn off chC and chD
if(ps3000aDeviceObj.channelCount == PicoConstants.QUAD_SCOPE)
    [status.setChA] = invoke(ps3000aDeviceObj, 'ps3000aSetChannel', 0, 1, 1, 6, 0.0);
    [status.setChB] = invoke(ps3000aDeviceObj, 'ps3000aSetChannel', 1, 1, 1, 9, 0.0);
    [status.setChC] = invoke(ps3000aDeviceObj, 'ps3000aSetChannel', 2, 0, 1, 8, 0.0);
    [status.setChD] = invoke(ps3000aDeviceObj, 'ps3000aSetChannel', 3, 0, 1, 8, 0.0);
end

%% setup signal generator
sigGenGroupObj = get(ps3000aDeviceObj, 'Signalgenerator');
sigGenGroupObj = sigGenGroupObj(1);
%[status.setSigGenBuiltInSimple] = invoke(sigGenGroupObj, 'setSigGenBuiltInSimple', 0);

%% Set Simple Trigger
triggerObj = get(ps3000aDeviceObj, 'Trigger');
triggerObj = triggerObj(1);
set(triggerObj, 'autoTriggerMs', 1000);
% Channel     : 0 (ps3000aEnuminfo.enPS3000AChannel.PS3000A_CHANNEL_A)
% Threshold   : 1000 (mV)
% Direction   : 2 (ps3000aEnuminfo.enPS3000AThresholdDirection.PS3000A_RISING)
[status.setSimpleTrigger] = invoke(triggerObj, 'setSimpleTrigger', 0, 1000, 2);

%% Verify Timebase Index and Maximum Number of Samples
status.getTimebase2 = PicoStatus.PICO_INVALID_TIMEBASE;
set(ps3000aDeviceObj, 'timebase', 1);       % set to 500 MHz sample rate
timebaseIndex = get(ps3000aDeviceObj, 'timebase');

[status.getTimebase2, timeIntervalNanoSeconds, maxSamples] = invoke(ps3000aDeviceObj, 'ps3000aGetTimebase2', timebaseIndex, 0);
if ~(status.getTimebase2 == PicoStatus.PICO_OK)
    error(scope doesnt like the sample rate')
end

%% Set Block Parameters and Capture Data
% Capture a block of data and retrieve data values for Channels A and B.
blockObj = get(ps3000aDeviceObj, 'Block');
blockObj = blockObj(1);

% start measurements
for freq = 1:length(testFreq)
    set(ps3000aDeviceObj.Signalgenerator(1), 'startFrequency',testFreq(freq));
    set(ps3000aDeviceObj.Signalgenerator(1), 'stopFrequency', testFreq(freq));
    set(ps3000aDeviceObj.Signalgenerator(1), 'offsetVoltage', 0);
    set(ps3000aDeviceObj.Signalgenerator(1), 'peakToPeakVoltage', VppOut);
    
    % turn on sig gen
    invoke(sigGenGroupObj, 'setSigGenBuiltIn', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    for iteration = 1:numberOfIterations
        for phase = 1:length(testPhases)
            testNo = testNo +1
            
            %%%% send signal to hardware under development            
            
            [status.runBlock] = invoke(blockObj, 'runBlock', 0); %% move this outside loop

            [numSamples, overflow, chA, chB, chC, chD] = invoke(blockObj, 'getBlockData', 0, 0, 1, 0);
            timeNs = double(timeIntervalNanoSeconds) * double(0:numSamples - 1);

        end
    end
    [status.setSigGenOff] = invoke(sigGenGroupObj, 'setSigGenOff'); % turn sig gen off
end

%% Stop and disconnect 
[status.stop] = invoke(ps3000aDeviceObj, 'ps3000aStop');

disconnect(ps3000aDeviceObj);
delete(ps3000aDeviceObj);

Post Reply