PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
clc
clear all;
global data;
buffersize = 2000;
% Library Loading ---------------------------------------------------------
aux = libisloaded('ps3000a');
switch(aux)
case 0
[notfound, pwarnings] = loadlibrary('ps3000a.dll','ps3000aApi.h', 'addheader' , 'picoStatus.h');
disp('## Biblioteca ps3000a.dll carregada ');
pwarnings;
case 1
unloadlibrary('ps3000a');
disp('## Unloading... ');
pause(1);
[notfound, pwarnings] = loadlibrary('ps3000a.dll','ps3000aApi.h', 'addheader' , 'picoStatus.h');
disp('## Biblioteca ps3000a.dll carregada ');
end
% Initialization of Picoscope ---------------------------------------------
data.unithandle = 0;
data.serial =[];
[status_open, data.unithandle, data.serial] = calllib('ps3000a', 'ps3000aOpenUnit', data.unithandle, data.serial);
get_pico_message(status_open);
assert(status_open == 0,'There is a problem while openning the unit!');
% Simples LED Flashing Test -----------------------------------------------
disp('Flash LED');
num_flashes = 2;
status = calllib('ps3000a', 'ps3000aFlashLed', data.unithandle, num_flashes);
get_pico_message(status);
% PingUnit ----------------------------------------------------------------
disp('Ping Unit');
status = calllib('ps3000a', 'ps3000aPingUnit', data.unithandle);
get_pico_message(status);
% SetChannel --------------------------------------------------------------
disp('Set Channel');
status = calllib('ps3000a', 'ps3000aSetChannel',...
data.unithandle, ... %% handle
0, ... %% channel A
1, ... %% enable
0, ... %% coupling type
3, ... %% input range (1V)
0.0); %% analogue offset
get_pico_message(status);
% GetTimebase -------------------------------------------------------------
% disp('Get Timebase');
% RunBlock
disp('Run Block');
ptime = libpointer('int32Ptr');
ppar = libpointer('voidPtr');
lpReady = libpointer('int16Ptr');
status = calllib('ps3000a', 'ps3000aRunBlock',...
data.unithandle, ... %% handle
0, ... %% noOfPreTriggerSamples
buffersize, ... %% noOfPostTriggerSamples
0, ... %% timebase
1, ... %% oversample 1-256
ptime, ... %% * timeIndisposedMs
0, ... %% segmentIndex
lpReady, ...
ppar);
get_pico_message(status);
% IsReady -----------------------------------------------------------------
disp('isReady');
ready = libpointer('int16Ptr', zeros(1,1));
status = calllib('ps3000a', 'ps3000aIsReady',...
data.unithandle, ... %% handle
ready); %% ready to collect
get_pico_message(status);
% SetDataBuffer -----------------------------------------------------------
disp('SetDataBuffer');
%bufferlocation = libpointer('int16Ptr', zeros(1,1));
buffer = libpointer('int16Ptr', zeros(buffersize,1));
status = calllib('ps3000a', 'ps3000aSetDataBuffer',...
data.unithandle, ... %% handle
0, ... %% channel A
buffer, ... %% buffer
buffersize, ... %% buffer lenght
0, ... %% segmentIndex
0); %% downsampling
get_pico_message(status);
%GetValues ----------------------------------------------------------------
disp('GetValues');
flow = libpointer('int16Ptr');
status = calllib('ps3000a', 'ps3000aGetValues',...
data.unithandle, ... %% handle
0, ... %% startIndex
buffersize, ... %% * noOfSamples
0, ... %% downsampling ratio
0, ... %% downsampling mode
0, ... %% segmentIndex
flow); %% overflow
get_pico_message(status);
pause(1);
status = calllib('ps3000a', 'ps3000aCloseUnit', data.unithandle);
disp('Closing Unit');
get_pico_message(status);
Code: Select all
ppar = [];
lpReady = [];