PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
%% SHOOTING SCRIPT
set(ps5000aDeviceObj, 'startFrequency', 500);
set(ps5000aDeviceObj, 'stopFrequency', 500);
offsetMv = 0;
pkToPkMv = 4000;
waveType = ps5000aEnuminfo.enPS5000AWaveType.PS5000A_SINE;
increment = 0; % Hz
dwellTime = 1; % seconds
sweepType = ps5000aEnuminfo.enPS5000ASweepType.PS5000A_UP;
operatiom = PicoConstants.FALSE;
shots = 1;
sweeps = 0;
triggerType = ps5000aEnuminfo.enPS5000ASigGenTrigType.PS5000A_SIGGEN_RISING;
triggerSource = ps5000aEnuminfo.enPS5000ASigGenTrigSource.PS5000A_SIGGEN_SOFT_TRIG;
extInThresholdMv = 0;
invoke(ps5000aDeviceObj, 'setSigGenBuiltIn', offsetMv, pkToPkMv, waveType, increment, ...
dwellTime, sweepType, operatiom, shots, sweeps, triggerType, triggerSource, extInThresholdMv);
invoke(ps5000aDeviceObj, 'ps5000aSigGenSoftwareControl', 1);
Code: Select all
%% SET DEVICE RESOLUTION
% Max. resolution with 2 channels enabled is 15 bits.
[status, resolution] = invoke(ps5000aDeviceObj, 'ps5000aSetDeviceResolution', 12);
set(ps5000aDeviceObj,'timebase',1);
%% 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, -200, 2, 0, 100);
%% GET TIMEBASE
% Driver default timebase index used - 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 : 65 (default)
% segment index: 0
[status, timeIntervalNanoSeconds, maxSamples] = invoke(ps5000aDeviceObj, 'ps5000aGetTimebase', 1, 0);
%% SET BLOCK PARAMETERS AND CAPTURE DATA
% Set pre-trigger samples.
set(ps5000aDeviceObj, 'numPreTriggerSamples', 1024);
% Capture a block of data:
%
% segment index: 0
[status] = invoke(ps5000aDeviceObj, 'runBlock', 0);
% 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(ps5000aDeviceObj, 'getBlockData', 0, 0, 1, 0);
% Stop the device
[status] = invoke(ps5000aDeviceObj, 'ps5000aStop');
%% PROCESS DATA
% Plot data values.
figure;
% Calculate time (nanoseconds) and convert to milliseconds
% Use timeIntervalNanoSeconds output from ps5000aGetTimebase or
% ps5000aGetTimebase2 or calculate from Programmer's Guide.
timeNs = double(timeIntervalNanoSeconds) * double([0:numSamples - 1]);
timeMs = timeNs / 1e6;
% Channel A
axisHandleChA = subplot(2,1,1);
plot(timeMs, chA, 'b');
title('Channel A');
xlabel(axisHandleChA, 'Time (ms)');
ylabel(axisHandleChA, 'Voltage (mV)');
% Channel B
axisHandleChB = subplot(2,1,2);
plot(timeMs, chB, 'r');
title('Channel B');
xlabel(axisHandleChB, 'Time (ms)');
ylabel(axisHandleChB, 'Voltage (mV)');
Code: Select all
%% SHOOTING SCRIPT PARAMETERS
set(ps5000aDeviceObj, 'startFrequency', 500);
set(ps5000aDeviceObj, 'stopFrequency', 500);
offsetMv = 0;
pkToPkMv = 4000;
waveType = ps5000aEnuminfo.enPS5000AWaveType.PS5000A_SINE;
increment = 0; % Hz
dwellTime = 1; % seconds
sweepType = ps5000aEnuminfo.enPS5000ASweepType.PS5000A_UP;
operatiom = PicoConstants.FALSE;
shots = 1;
sweeps = 0;
triggerType = ps5000aEnuminfo.enPS5000ASigGenTrigType.PS5000A_SIGGEN_RISING;
triggerSource = ps5000aEnuminfo.enPS5000ASigGenTrigSource.PS5000A_SIGGEN_SOFT_TRIG;
extInThresholdMv = 0;
%% SET DEVICE RESOLUTION
% Max. resolution with 2 channels enabled is 15 bits.
[status, resolution] = invoke(ps5000aDeviceObj, 'ps5000aSetDeviceResolution', 12);
set(ps5000aDeviceObj,'timebase',1);
%% 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, -200, 2, 0, 100);
%% GET TIMEBASE
% Driver default timebase index used - 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 : 65 (default)
% segment index: 0
[status, timeIntervalNanoSeconds, maxSamples] = invoke(ps5000aDeviceObj, 'ps5000aGetTimebase', 1, 0);
%% CALLING SIGGENBUILTIN
invoke(ps5000aDeviceObj, 'setSigGenBuiltIn', offsetMv, pkToPkMv, waveType, increment, ...
dwellTime, sweepType, operatiom, shots, sweeps, triggerType, triggerSource, extInThresholdMv);
%% SET BLOCK PARAMETERS AND CAPTURE DATA
% Set pre-trigger samples.
set(ps5000aDeviceObj, 'numPreTriggerSamples', 1024);
% Capture a block of data:
[status] = invoke(ps5000aDeviceObj, 'runBlock', 0);
% 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(ps5000aDeviceObj, 'getBlockData', 0, 0, 1, 0);
%% CALLING SIGGENCONTROL
invoke(ps5000aDeviceObj, 'ps5000aSigGenSoftwareControl', 1);
%% LOOP
invoke(ps5000aDeviceObj, 'ps5000aIsReady')
Code: Select all
Error using privateExecuteMCode (line 44)
runBlock: Error in ps5000aRunBlock call - code 14
Error in instrgate (line 20)
[varargout{1:nout}] = feval(varargin{:});
Error in icdevice/invoke (line 70)
output = instrgate('privateExecuteMCode', code, obj, varargin, nargout);
Error in Control (line 56)
[status] = invoke(ps5000aDeviceObj, 'runBlock', 0);
Code: Select all
set(ps5000aDeviceObj, 'timebase', 3);