PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% connect to device
PS5000aConfig;
obj.deviceobject = icdevice('picotech_ps5000a_generic.mdd');
connect(obj.deviceobject);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% now start signal generator
freq = 1000;
set(obj.deviceobject, 'startFrequency', freq);
set(obj.deviceobject, 'stopFrequency', freq);
offsetMv = 0;
pkToPkMv = 1000;
waveType = ps5000aEnuminfo.enPS5000AWaveType.PS5000A_SINE;
increment = 0;
dewllTime = 0;
sweepType = 0;
operation = 0;
shots = 20;
sweeps = 0;
triggerType = ps5000aEnuminfo.enPS5000ASigGenTrigType.PS5000A_SIGGEN_RISING;
triggerSource = ps5000aEnuminfo.enPS5000ASigGenTrigSource.PS5000A_SIGGEN_EXT_IN;
extInThreshold = 4000;
[status] = invoke(obj.deviceobject, 'setSigGenBuiltIn', offsetMv, pkToPkMv, waveType, increment, dewllTime, sweepType, operation, shots, sweeps, triggerType, triggerSource, extInThreshold);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% now start the scope
triggerchannel = 4; % the ext trigger channel
threshold = 4000;
direction = 2; % rising
delay = 1000;
autotrigger = 0;
[status] = invoke(obj.deviceobject, 'setSimpleTrigger', triggerchannel, threshold, direction, delay, autotrigger);
resolution = 12
[status, resolution] = invoke(obj.deviceobject, 'ps5000aSetDeviceResolution', resolution);
thistimebase = 9
set(obj.deviceobject, 'timebase', thistimebase);
mynumsamples = 1e6
set(obj.deviceobject, 'numPostTriggerSamples', mynumsamples);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% catch data
h1 = figure;
for i = 1:10
% Capture a block of data: % segment index: 0
[status] = invoke(obj.deviceobject, 'runBlock', 0);
pause(0.1);
% Retrieve data values:
% start index : 0 % segment index : 0 % downsampling ratio: 1
% downsampling mode : 0 (PS5000A_RATIO_MODE_NONE)
[chA, chB, chC, chD, numSamples, overflow] = invoke(obj.deviceobject, 'getBlockData', 0, 0, 1, 0);
pause(1);
figure(h1);
plot(chB);
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% disconnect
invoke(obj.deviceobject, 'setSigGenOff');
disconnect(obj.deviceobject);
Code: Select all
#define PICO_WARNING_EXT_THRESHOLD_CONFLICT 0x00000033UL
Code: Select all
%% SET SIMPLE TRIGGER
% Channel : 0 (PS5000A_CHANNEL_A)
% Threshold : 1000 (mV)
% Direction : 2 (Rising)
% Delay : 0
% Auto trigger: 0 (wait indefinitely)
[status] = invoke(ps5000aDeviceObj, 'setSimpleTrigger', 0, 1000, 2, 0, 0);