Rapid acquisition in 4 channels

Post your MATLAB discussions here
Post Reply
francesc
Newbie
Posts: 1
Joined: Mon Oct 09, 2017 11:32 am

Rapid acquisition in 4 channels

Post by francesc »

Hi,

I own a Picoscope 6402C, and I control it via Matlab. Everything works good. I get data from the 4 channels simultaneously, so the maximum sampling rate I can use is 1.25 GSa/s. So far, so goog.

Until now, I acquired data using the normal "Block mode", calling "runBlock" and "getBlockData". However, I have faced a new situation that I need to solve and I am not sure how to do it.

I need to:

1. Set a trigger to chA, and acquire 10000 Samples from chC. Then,
2. Set a trigger to chC, and acquire 10000 Samples from chA. Then,
3. Set a trigger to chD, and acquire 10000 Samples from chB. Then,
4. Set a trigger to chB, and acquire 10000 Samples from chD.

The problem is that the time between points 1 and 2 (and also between 2 and 3, and also 3 and 4) have to be less or equal to 1 ms.

If I run the whole sequence 1,2,3,4 and measure the time required to do it, it takes 0.5 s for each step, so a total time interval of approximately 2 s.

Is there any way I can reduce this time between steps from 0.5 s to 1 ms?
I have been looking at examples using the rapid block mode, but they collect segments of data in a single channel, I need to collect data from different channels.

Any ideas on how can I solve this problem?

Many thanks,
Fran

NeilH
PICO STAFF
PICO STAFF
Posts: 260
Joined: Tue Jul 18, 2017 8:28 am

Re: Rapid acquisition in 4 channels

Post by NeilH »

Hi Fran

Would you be able to give some more details about what you're trying to achieve with your 6402C?

Depending on these details I will hopefully be able to give the best way to achieve your aim and solve your problem.

Neil
Neil
Technical Support Engineer

francesc
Newbie
Posts: 1
Joined: Mon Oct 09, 2017 11:32 am

Re: Rapid acquisition in 4 channels

Post by francesc »

Yes, I will try to give all the detailed information on what I need to do.

I have a system with 4 sensors, connected to the 4 channels in the picoscope. At t=0, sensor A sends a signal (ultrasonic pulse) to sensor C, then at t=1 ms (approximately), sensor C sends a signal to sensor A. At t=4 ms, sensor D sends a signal to sensor B, and at t=5 ms sensor B sends a signal to sensor D. Then, the system waits for 495 microseconds, and repeats all these steps indefinitely. The time of flight of the signal is 120 us (microseconds) approximately. Hence, if the pulse is sent at t=0 in channel A (chA), the response of this pulse is collected at t=120 us approximately in chC. I can not change any of the timings described above.

The system works in the following way:

1. A pulse (3V amplitude, 300ns width) is sent through chA (and will be received by sensor C, in chC). 120 us (microseconds) later, the response of this pulse is collected in chC. The response is of the order of millivolts so I set all the channel ranges to +-50mV. I need to store 10000 points of this response at the maximum sampling rate possible, hence what I do is to set the timebase to 2 (0.8 ns), a trigger in chA (500mV, rising edge), a delay (of 144000 samples), and then I set the number of posttrigger samples to 10000. Then, I run the getblockdata function and store the chC data. I can plot the data obtained in chC, and it's ok.

2. Just 1 ms after the first pulse was sent, a new pulse (3V amplitude, 300ns width) is sent through chC (and will be received by sensor A in chA). 120 us (microseconds) later, the response of this pulse is collected in chA. ThereforeI now I set the same trigger as before but in chC, and store the data from chA.

3. And the same, replacing chA and chC by chD and chB.

My problem is that the time required to set the trigger in chA, invoke runblock, run getBlockData and save data of chC, and then set the trigger in chC, invoke runblock, run getBlockData and save data of chA, all of this lasts 0.5 seconds, and I need to do it in less than a microsecond, in order to catch the pulse that occurs 1 ms after the first one in chA, and not the second in the next half second.

Is there any way (segmenting memory? using rapid block mode?) that I can save all the signals in the same 5 ms?

One possbility is to set the trigger in chA, and then save all the data corresponding to 5 ms. Therefore, I would have all the pulses and all the responses in a single matrix (but I need to store 7.3 MSamples of data for each channel, and then cut "windows" of the data that I need, since the postprocessing is demanding). But it would be much better way If I could:
set trigger to chA, save chC, then set trigger to chC, save chA, then set trigger to chD, save chB and finally set trigger to chB and save chD. All these in less than 5 ms. Is this possible?

I attach a Matlab script that does what I explained, with a time between "toc"s of 0.5 s approximately. It should be less than 1 ms to be good for me:

Code: Select all

clc;
close all;
clearvars;

PS6000Config;

%% Device Connection
% Check if an Instrument session using the device object 'ps6000DeviceObj'
% is still open, and if so, disconnect if the User chooses 'Yes' when prompted.
if (exist('ps6000DeviceObj', 'var') && ps6000DeviceObj.isvalid && strcmp(ps6000DeviceObj.status, 'open'))
    openDevice = questionDialog(['Device object ps6000DeviceObj has an open connection. ' ...
        'Do you wish to close the connection and continue?'], ...
        'Device Object Connection Open');
    if (openDevice == PicoConstants.TRUE)
        disconnect(ps6000DeviceObj);
        delete(ps6000DeviceObj);
    else
        return;
    end
end

ps6000DeviceObj = icdevice('picotech_ps6000_generic.mdd', '');
connect(ps6000DeviceObj);
set(ps6000DeviceObj, 'displayOutput', PicoConstants.FALSE);

voltageRangeIndex = ps6000Enuminfo.enPS6000Range.PS6000_50MV;
coupling          = ps6000Enuminfo.enPS6000Coupling.PS6000_DC_1M;
[status.setChA] = invoke(ps6000DeviceObj, 'ps6000SetChannel', 0, 1, coupling, voltageRangeIndex, 0.0, 0);
[status.setChB] = invoke(ps6000DeviceObj, 'ps6000SetChannel', 1, 1, coupling, voltageRangeIndex, 0.0, 0);
[status.setChC] = invoke(ps6000DeviceObj, 'ps6000SetChannel', 2, 1, coupling, voltageRangeIndex, 0.0, 0);
[status.setChD] = invoke(ps6000DeviceObj, 'ps6000SetChannel', 3, 1, coupling, voltageRangeIndex, 0.0, 0);
timebaseIndex = 2;
set(ps6000DeviceObj, 'timebase', timebaseIndex);
[status.getTimebase2, timeIntervalNanoSeconds, maxSamples] = invoke(ps6000DeviceObj, 'ps6000GetTimebase2', timebaseIndex, 0);
triggerGroupObj = get(ps6000DeviceObj, 'Trigger');
triggerGroupObj = triggerGroupObj(1);
set(triggerGroupObj, 'delay', 144000);
set(triggerGroupObj, 'autoTriggerMs', 1000);
thresholdVoltage = 50;
set(ps6000DeviceObj, 'numPreTriggerSamples', 0);
set(ps6000DeviceObj, 'numPostTriggerSamples', 1e4);
blockGroupObj = get(ps6000DeviceObj, 'Block');
blockGroupObj = blockGroupObj(1); 

tic
[status.setSimpleTrigger] = invoke(triggerGroupObj, 'setSimpleTrigger', 0, thresholdVoltage, 2);
[status.runBlock] = invoke(blockGroupObj, 'runBlock', 0);
[numsamples, ~, ~, ~, chC, ~] = invoke(blockGroupObj, 'getBlockData', 0, 0, 1, 0);
toc
[status.setSimpleTrigger] = invoke(triggerGroupObj, 'setSimpleTrigger', 2, thresholdVoltage, 2);
[status.runBlock] = invoke(blockGroupObj, 'runBlock', 0);
[~, ~, chA, ~, ~, ~] = invoke(blockGroupObj, 'getBlockData', 0, 0, 1, 0);
toc
[status.setSimpleTrigger] = invoke(triggerGroupObj, 'setSimpleTrigger', 3, thresholdVoltage, 2);
[status.runBlock] = invoke(blockGroupObj, 'runBlock', 0);
[numSamples, ~, ~, chB, ~, ~] = invoke(blockGroupObj, 'getBlockData', 0, 0, 1, 0);
toc
[status.setSimpleTrigger] = invoke(triggerGroupObj, 'setSimpleTrigger', 1, thresholdVoltage, 2);
[status.runBlock] = invoke(blockGroupObj, 'runBlock', 0);
[~, ~, ~, ~, ~, chD] = invoke(blockGroupObj, 'getBlockData', 0, 0, 1, 0);
toc
[status.stop] = invoke(ps6000DeviceObj, 'ps6000Stop');

figure1 = figure('Name','PicoScope 6000 Series Example - Block Mode Capture', ...
    'NumberTitle', 'off');

timeNs = double(timeIntervalNanoSeconds) * double(0:numSamples - 1);
plot(timeNs,chA,'-b',timeNs,chB,'-r',timeNs,chC,'-g',timeNs,chD,'-y');

disconnect(ps6000DeviceObj);
delete(ps6000DeviceObj);

Thanks!

NeilH
PICO STAFF
PICO STAFF
Posts: 260
Joined: Tue Jul 18, 2017 8:28 am

Re: Rapid acquisition in 4 channels

Post by NeilH »

Hi Fran

The only way to constantly collect this data would be to collect from all 4 channels for the full time due to the time needed to make the changes to the scope settings by the drivers.

Neil
Neil
Technical Support Engineer

francesc
Newbie
Posts: 1
Joined: Mon Oct 09, 2017 11:32 am

Re: Rapid acquisition in 4 channels

Post by francesc »

ok! I will do it this way then

Post Reply