Test and Measurement Forum

ETS mode Matlab

Post your MATLAB discussions here

ETS mode Matlab

Postby korkikian » Sat Feb 15, 2014 4:46 pm

Hello,

I am trying to activate ETS mode via Matlab.
I was trying to use Picoscope 3000 Series Programmers Manual but on the page 16 the ETS activation algorithm is wrong or at least not complete: there is no ps3000aSetEts function in this algorithm.
Later I took documentation from Picoscope 5000 Series and at least there was a mention about ps5000aSetEts function. However, I could not use ps3000aSetEts on my machine because it always returned an error (see below).
Do you have any idea what I am doing wrong?

Code: Select all
clear;
%% Set Path

% Edit as required
addpath('C:\Users\Roman\Desktop\Pico\Wrapper\Release\Win32')
addpath('..\');
addpath('..\Functions');
addpath('C:\Users\Roman\Desktop\Pico');

%% Load in PicoStatus values
PicoStatus;

%% Declare variables
global data;

data.TRUE = 1;
data.FALSE = 0;
data.BUFFER_SIZE = 1000;

data.timebase = 0;
data.oversample = 1;

data.scaleVoltages = data.TRUE;
data.inputRangesmV = [10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000];

% Data Buffers

pBufferChA = libpointer('int16Ptr',zeros(data.BUFFER_SIZE,1));
pBufferChB = libpointer('int16Ptr',zeros(data.BUFFER_SIZE,1));



plotData = data.TRUE;

%% Device Connection

% Create device
ps3000a_obj = icdevice('PS3000a_IC_drv', ''); % Specify serial number as 2nd argument if required.

% Connect device
connect(ps3000a_obj);

% Provide access to enumerations and structures
[methodinfo, structs, enuminfo, ThunkLibName] = PS3000aMFile;

%% Show unit information
info_status = invoke(ps3000a_obj, 'GetUnitInfo');

%% Obtain Maximum & Minimum values
max_val_status = invoke(ps3000a_obj, 'ps3000aMaximumValue');

% disp('Max ADC value:');
% ps3000a_obj.maxValue;

min_val_status= invoke(ps3000a_obj, 'ps3000aMinimumValue');

% disp('Min ADC value:');
% ps3000a_obj.minValue


%% Channel settings

% Channel settings - create a struct

% Channel A
channelSettings(1).enabled = data.TRUE;
channelSettings(1).DCCoupled = data.TRUE;
channelSettings(1).range = enuminfo.enPS3000ARange.PS3000A_50MV;

% Channel B
channelSettings(2).enabled = data.FALSE;
channelSettings(2).DCCoupled = data.TRUE;
channelSettings(2).range = enuminfo.enPS3000ARange.PS3000A_5V;

%% Set Defaults for Channels

status_set_defaults = invoke(ps3000a_obj, 'setDefaults', channelSettings);

channelB = enuminfo.enPS3000AChannel.PS3000A_CHANNEL_B;

status = invoke(ps3000a_obj, 'ps3000aSetChannel', channelB, data.FALSE, data.TRUE, enuminfo.enPS3000ARange.PS3000A_50MV, 0.0);

disp('SetChannel: Ch. B')
status

%%Try to set ETS mode

sampleTimePicosecond = libpointer('int64Ptr',zeros(data.BUFFER_SIZE,1));

status = invoke(ps3000a_obj, 'ps3000aSetEts', enuminfo.enPS3000AEtsMode.PS3000A_ETS_SLOW, 1, 1, sampleTimePicosecond);

disp('ETS status')
status

%% Set Simple Trigger

enable = data.TRUE;
% source = enuminfo.enPS3000AChannel.PS3000A_CHANNEL_B;
source = enuminfo.enPS3000AChannel.PS3000A_EXTERNAL;

threshold = mv2adc(1000, data.inputRangesmV(enuminfo.enPS3000ARange.PS3000A_5V + 1), ps3000a_obj.maxValue);
direction = enuminfo.enPS3000AThresholdDirection.PS3000A_RISING;

delay = 0;             
autoTrigger_ms = 0; % Wait indefinitely

trigger_status = invoke(ps3000a_obj, 'ps3000aSetSimpleTrigger', ...
    enable, source, threshold, direction, delay, autoTrigger_ms);

%% Set Data Buffers

channelA = enuminfo.enPS3000AChannel.PS3000A_CHANNEL_A;

status = invoke(ps3000a_obj, 'ps3000aSetDataBuffer', ...
    channelA, pBufferChA, data.BUFFER_SIZE, 0, 0);

disp('SetDataBuffer: Ch. A')
status

%% Set Timebase

timeIndisposed = 0;
maxSamples = data.BUFFER_SIZE;
timeIntNs = 0;
segmentIndex = 0;

[get_timebase2_status, timeIntNs1, maxSamples1] = invoke(ps3000a_obj, 'ps3000aGetTimebase2', ...
        data.timebase, data.BUFFER_SIZE, ...
        timeIntNs, data.oversample, maxSamples, segmentIndex);
   
disp('Timebase')
data.timebase

get_timebase2_status
timeIntNs1
maxSamples

%% Disconnect device

disconnect(ps3000a_obj);


and the response:

Code: Select all
Warning: The data type 'FcnPtr' used by function ps3000aRunBlock does not exist.
Warning: The data type 'FcnPtr' used by function ps3000aGetStreamingLatestValues does not exist.
Opening device...

   Instrument Device Object Using Driver : PS3000a_IC_drv.mdd

   Instrument Information
      Type:               Oscilloscope
      Manufacturer:       Pico Technology Ltd.
      Model:              PicoScope 3000 Series

   Driver Information
      DriverType:         MATLAB generic
      DriverName:         PS3000a_IC_drv.mdd
      DriverVersion:      1.0

   Communication State
      Status:             open

Connected to PicoScope device:-
Handle: 16384
Batch/Serial number: CO130/180
InstrumentModel: 3207A
Number of channels: 2
Signal Generator type: Function Generator

connect_status =

       open_unit: 0
     unit_serial: 0
    unit_variant: 0


unit_info_values =

    'Driver: 1.0.0.386'
    'USB: 3.0'
    'HW: 1'
    'Variant: 3207A'
    'Batch & Serial: CO130/180'
    'Cal Date: 11Apr13'
    'Kernel: 1.0'
    'Digital HW: 1'
    'Analog HW: 1'

SetChannel: Ch. B

status =

     0

Error using privateExecuteMCode (line 44)
Library was not found

Error in instrgate (line 21)
   [varargout{1:nout}] = feval(varargin{:});

Error in icdevice/invoke (line 71)
        output = instrgate('privateExecuteMCode', code, obj, varargin, nargout);

Error in ETSmodeTestbench (line 122)
status = invoke(ps3000a_obj, 'ps3000aSetEts', enuminfo.enPS3000AEtsMode.PS3000A_ETS_SLOW, 1, 1, sampleTimePicosecond);
korkikian
Newbie
 
Posts: 0
Joined: Tue Nov 26, 2013 10:03 pm

Re: ETS mode Matlab

Postby Hitesh » Mon Feb 17, 2014 10:17 am

Hi korkikian,

The library file name was incorrect in the function definition in the Instrument Driver so an updated Instrument Driver file will be sent to you in response to your e-mail.

With regards to the Programmer's Guides, I will request updates to be made to correct the issues.

Thanks,
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 1 guest