A few questions

Post your MATLAB discussions here
Post Reply
mpdefeo
Newbie
Posts: 0
Joined: Wed Sep 04, 2013 8:14 pm

A few questions

Post by mpdefeo »

I have a few questions regarding the picoscope 6404b and matlab.

1. When acquiring data from more than 1 channel in rapid block mode, how is the data stored in the digitizer? Do they alternate segments, or are they concatenated into a single segment. For instance, If I am acquiring 1000 segments with channels A and B enabled, is the data stored as:

seg. 1 A
seg. 2 B
seg. 3 A
seg. 4 B

or is it stored as:

seg. 1 AB
seg. 2 AB
seg. 3 AB

or in some other way?

Do I need to take this into account when allocating memory segments? For instance, if I want to acquire 1000 traces of 2000 points on 2 channels do I need to allocate 1000 memory segments of length 2000, 2000 memory segments of length 2000, or 1000 memory segments of length 4000 (if A and B are stored in same segment). Or is all of this taken care of by the driver.

2. Is there a more streamlined way to prepare the libpointers in matlab when using the 'setdatabufferbulk' than running it in a for loop. If I am acquiring ~65000 segments of 1000 pts. each on two channels, this process takes about 20 min. I am not sure if this is due to the overhead of communicating with the card, or if matlab doesn't like changing the size of large arrays. Would it help to create the an array of libpointers first, then iterate through the channels and segments call 'setdatabuffersbulk' in nested for loops?

3. Once the the libpointers have been defined and populated with data from the picoscope, is it considered poor hygene to reuse the structures for future (identical) acquisitions, or should they be cleared once the data has been extracted from the?

4. I have not been able to set the aux port for triggering using the 'setsimpletrigger' command. Is it possible to use this command for setting a trigger on the aux port, or do i need to set a advanced trigger?

5. If I use one of the 4 channels on the front panel of the scope for a trigger do I have to acquire the trigger signal aswell, or can I just trigger off of that channel without acquiring.

6. When using the picoscope 6 software, I notice a significant ammount of jitter when triggering off of the aux port compared to triggering off one of the channels with the same trigger signal.

Sorry for the barrage of questions.

Mike

Hitesh

Re: A few questions

Post by Hitesh »

Hello Mike,

The memory is divided into segments, and the memory in those segments is proportioned against the number of channels enabled.

To acquire 1000 traces of 2000 points on both channel A and B, you only have to tell the driver to setup a minimum of 1000 segments (setting up 1024 might be better as a power of two). The driver will then ensure 2000 samples are collected per channel per segment as it is within the buffer memory limit of the scope.

With regards to question 2, this is something I am investigating and will post back when I have an update. If you can post the code that shows how you are setting the libpointers up, that might be useful.

You can reuse the structures for later data acquisition, but it might be helpful to set them to zeros if possible for the next acquisition.

I don't think you have to acquire the signal on a channel - simply do not set data buffer for the channel that you do not wish to acquire data for.

I will also look into questions 4 and 6 and post back when I have an update. Please post the code that shows how you are calling the ps6000SetSimpleTrigger function.

Regards,

Hitesh

Re: A few questions

Post by Hitesh »

Update:

For q2, please try the following:

Code: Select all

%% SETUP SEGMENTS AND CAPTURES

disp('Segments and Captures')

% Divide memory into segments
nSegments = 65000; % Max for 6404D is 2000000 segments
nMaxSamples = 0;

[status.segments, nMaxSamples] = calllib('PS6000', 'ps6000MemorySegments', handle, nSegments, nMaxSamples);

% Set number of captures (can be less than segments)

nCaptures = 65000;

[status.setNumCaptures] = calllib('PS6000', 'ps6000SetNoOfCaptures', handle, nCaptures);

%% SET UP DATA BUFFERS

% This can take time so better to do this before a capture if capturing
% succesive sets of rapid block captures

numPreTriggerSamples = 0;
numPostTriggerSamples = 1000;
num_samples = numPreTriggerSamples + numPostTriggerSamples;
downSampleRatio = 1;
downSampleRatioMode = ps6000Enuminfo.enPS6000RatioMode.PS6000_RATIO_MODE_NONE;

% Create an array of libpointers

disp('Setup libpointer array')

tic;

rapidBlockBuffer(4, nCaptures) = libpointer;
status.setDataBufferBulk = uint32(-1 * ones(4, nCaptures));

for ch = 1:4
   
    for segment = 1:nCaptures
    
        if(channelSettings(ch).enabled)
            
            rapidBlockBuffer(ch, segment) = libpointer('int16Ptr', zeros(num_samples, 1));
            
        end
        
    end
end

toc;
This assumes you have a channelSettings structure e.g.

Code: Select all

%% SET CHANNELS

channelA = ps6000Enuminfo.enPS6000Channel.PS6000_CHANNEL_A;
channelB = ps6000Enuminfo.enPS6000Channel.PS6000_CHANNEL_B;

channelSettings(1).enabled = 1;
channelSettings(1).type = ps6000Enuminfo.enPS6000Coupling.PS6000_DC_1M;
channelSettings(1).range = ps6000Enuminfo.enPS6000Range.PS6000_5V;
channelSettings(1).analogueOffset = 0.0;
channelSettings(1).bandwidth = ps6000Enuminfo.enPS6000BandwidthLimiter.PS6000_BW_FULL;

channelSettings(2).enabled = 1;
channelSettings(2).type = ps6000Enuminfo.enPS6000Coupling.PS6000_DC_1M;
channelSettings(2).range = ps6000Enuminfo.enPS6000Range.PS6000_5V;
channelSettings(2).analogueOffset = 0.0;
channelSettings(2).bandwidth = ps6000Enuminfo.enPS6000BandwidthLimiter.PS6000_BW_FULL;
I use prototype mfiles to access the enumeration information from the header file..

I hope this helps.

Hitesh

Re: A few questions

Post by Hitesh »

To answer Questions 4 and 6:-

The following C code shows the parameters you can set to trigger at a level of 500mV, with the signal rising:

Code: Select all

status = ps6000SetSimpleTrigger(unit->handle, 1, PS6000_TRIGGER_AUX, 16384, PS6000_RISING, 0, 0);
Note that the input range on the Aux IO is +/- 1V.

With regards to the jitter, the auxiliary trigger input is on a separate circuit to the channels.

Post Reply