Test and Measurement Forum

Matlab SDK functions settings explained

Post your MATLAB discussions here

Matlab SDK functions settings explained

Postby anm » Wed Sep 27, 2017 10:47 am

Hi to the community,

I want to run my Picoscope 5444B in rapid block mode, through Matlab SDK, so I am trying to set properly the PS5000A_ID_Block_Example.m script that is given. The problem is that I cannot find anywhere the values that are eligible for the various functions inside the script and things are getting really frustrating. For example:
Code: Select all

% Default driver settings used - use ps5000aSetChannel to turn channels on
% or off and set voltage ranges, coupling, as well as analogue offset.

How can I select a channel to turn it on and off?

Code: Select all

% Channel     : 0 (PS5000A_CHANNEL_A)
% Threshold   : 500 (mV)
% Direction   : 2 (Rising)
% Delay       : 0
% Auto trigger: 0 (wait indefinitely)

[status] = invoke(ps5000aDeviceObj, 'setSimpleTrigger', 0, 500, 2, 0, 0);

If I want to use channel B as trigger, should I change the first zero to 1?

Code: Select all

% Use ps5000aGetTimebase or ps5000aGetTimebase2 to query the driver as to
% suitability of using a particular timebase index then set the 'timebase'
% property if required.

% timebase      : 4 (16ns at 12-bit resolution)
% segment index : 0

[status, timeIntNs, maxSamples] = invoke(ps5000aDeviceObj, 'ps5000aGetTimebase', 4, 0);

What is the relation between 4 and the 16ns? What does 4 stand for?

Is there a guide explaining the Matlab functions? The most relevant guide I could find was https://www.picotech.com/download/manua ... rGuide.pdf
but it didn't include any explanations about the Matlab functions and their parameters.

Thank you in advance for your help!

Kind regards,

The instrhelp command (e.g. "instrhelp(ps5000aDeviceObj, 'ps5000aSetChannel');") returns me an error saying "Undefined function or variable 'ps5000aDeviceObj'.".
Posts: 0
Joined: Wed Sep 27, 2017 10:22 am

Re: Matlab SDK functions settings explained

Postby NeilH » Fri Oct 06, 2017 11:25 am

Hi anm

All the enumeration values can be found in the ps5000MFile.m in either the win32 or win64 depending on your OS.

The code below shows how to turn channel B on or off.
Code: Select all
%turn Channel B on
invoke(ps5000aDeviceObj, 'ps5000aSetChannel', 1, 1, 1, 8, 0.0); % Channel B

%turn Channel B off
invoke(ps5000aDeviceObj, 'ps5000aSetChannel', 1, 0, 1, 8, 0.0); % Channel B

% Coupling : 1 (PS5000A_DC)
% Range    : 8 (PS5000A_5V)
% Offset   : 0.00

The basic layout of the setChannel is

Code: Select all
invoke(ps5000aDeviceObj, 'ps5000aSetChannel', Channel, On/off, Coupling, Range, offset);

Where you replace the field names with the appropriate enumeration value, which can be found in the ps5000MFile mentioned above.

For the trigger if you wanted to use channel B instead of A it changes to to

Code: Select all
[status] = invoke(ps5000aDeviceObj, 'setSimpleTrigger', 1, 500, 2, 0, 0);

as you said would be the change.
The basic channel enumeration values are A=0, B=1, C=2, D=3 for any instance you need to set a channel,

For setting a timebase you pass an integer value that corresponds to a sampling interval specified in the device driver, the corresponding sampling timebases to the passed integer can be found in the programmer's guide on our website under Timebases.
https://www.picotech.com/download/manua ... -guide.pdf

If you need anymore help just ask.

Technical Support Engineer
Posts: 24
Joined: Tue Jul 18, 2017 8:28 am

Return to MATLAB

Who is online

Users browsing this forum: No registered users and 0 guests