PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
set(ps5000aDeviceObj, 'startFrequency', 10e6);
set(ps5000aDeviceObj, 'stopFrequency', 10e6);
Code: Select all
%% LOAD CONFIGURATION INFORMATION
PS5000aConfig;
%% DEVICE CONNECTION
% Create a device object.
ps5000aDeviceObj = icdevice('picotech_ps5000a_generic.mdd');
% Connect device object to hardware.
connect(ps5000aDeviceObj);
%% SET CHANNELS
% Default driver settings used - use ps5000aSetChannel to turn channels on
% or off and set voltage ranges, coupling, as well as analogue offset.
%% SET DEVICE RESOLUTION
% Max. resolution with 2 channels enabled is 15 bits.
[status, resolution] = invoke(ps5000aDeviceObj, 'ps5000aSetDeviceResolution', 14);
%% SET SIMPLE TRIGGER
% Channel : 0 (PS5000A_CHANNEL_A)
% Threshold : 1 (mV)
% Direction : 2 (Rising)
% Delay : 0
% Auto trigger: 0 (wait indefinitely)
[status] = invoke(ps5000aDeviceObj, 'setSimpleTrigger', 0, 0, 2, 0, 0);
%% 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 : 14 == 10MHz (time interval 100ns)
% segment index: 0
[status, timeIntervalNanoSeconds, maxSamples] = invoke(ps5000aDeviceObj, 'ps5000aGetTimebase', 14.5, 0);
%% SET BLOCK PARAMETERS
Nsamples = 1024;
samplingRate = 1/(double(timeIntervalNanoSeconds)*1e-9);
% Set pre-trigger samples.
set(ps5000aDeviceObj, 'numPreTriggerSamples', 0);
set(ps5000aDeviceObj, 'numPostTriggerSamples', Nsamples); %% Samples to record after trigger
%% Start the AWG
% Configure property value(s).
% awgBufferSize = get(ps5000aDeviceObj, 'awgBufferSize');
f = 2.5e6;
t = linspace(0,1/f,Nsamples);
y = normalise(sin(2*pi*f*t));
% load('RF_test_sig.mat');
% y = normalise(RF_test_sig);
% Set parameters
% Set the frequency in the Instrument Driver
set(ps5000aDeviceObj, 'startFrequency', 4*f);
set(ps5000aDeviceObj, 'stopFrequency', 4*f);
offsetMv = 0;
pkToPkMv = 2000;
increment = 0; % Hz
dwellTime = 1; % seconds
sweepType = ps5000aEnuminfo.enPS5000ASweepType.PS5000A_UP;
operation = PicoConstants.FALSE;
sweepType = ps5000aEnuminfo.enPS5000AIndexMode.PS5000A_SINGLE;
shots = 1000000;
sweeps = 0;
triggerType = ps5000aEnuminfo.enPS5000ASigGenTrigType.PS5000A_SIGGEN_RISING;
triggerSource = ps5000aEnuminfo.enPS5000ASigGenTrigSource.PS5000A_SIGGEN_SOFT_TRIG;
extInThresholdMv = 0;
% Call function
invoke(ps5000aDeviceObj, 'setSigGenArbitrary', offsetMv, pkToPkMv, increment, dwellTime, ...
y, sweepType, operation, sweepType, shots, sweeps, triggerType, triggerSource, extInThresholdMv);
% Software trigger the AWG to output a single cycle of the waveform
invoke(ps5000aDeviceObj, 'ps5000aSigGenSoftwareControl', 1);
%% CAPTURE DATA
% 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');
invoke(ps5000aDeviceObj, 'setSigGenOff');
%% 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]);
timeus = timeNs / 1e3;
% Channel A
axisHandleChA = subplot(2,1,1);
plot(timeus, normalise(chA), 'b');
title('Channel A');
xlabel(axisHandleChA, 'Time (us)');
ylabel(axisHandleChA, 'Voltage (mV)');
% original Signal
axisHandleOrig = subplot(2,1,2);
plot(t.*1e6, y, 'r');
title('Original Signal');
xlabel(axisHandleOrig, 'Time (us)');
ylabel(axisHandleOrig, 'Voltage (mV)');
%% DEVICE DISCONNECTION
samplingRate
% Disconnect device object from hardware.
disconnect(ps5000aDeviceObj);
Code: Select all
set(ps5000aDeviceObj, 'timebase', 4);
Code: Select all
[status] = invoke(ps5000aDeviceObj, 'runBlock', 0);
Code: Select all
%% LOAD CONFIGURATION INFORMATION
PS5000aConfig;
%% DEVICE CONNECTION
% Create a device object.
ps5000aDeviceObj = icdevice('picotech_ps5000a_generic.mdd');
% Connect device object to hardware.
connect(ps5000aDeviceObj);
%% SET CHANNELS
% Default driver settings used - use ps5000aSetChannel to turn channels on
% or off and set voltage ranges, coupling, as well as analogue offset.
%% SET DEVICE RESOLUTION
% Max. resolution with 2 channels enabled is 15 bits.
[status, resolution] = invoke(ps5000aDeviceObj, 'ps5000aSetDeviceResolution', 14);
%% SET SIMPLE TRIGGER
% Enable : 0 Disable - any non-zero value will trigger
% Channel : 0 (PS5000A_CHANNEL_A)
% Threshold : 0 (mV)
% Direction : 2 (Rising)
% Delay : 0
% Auto trigger: 0 (wait indefinitely)
[status] = invoke(ps5000aDeviceObj, 'setSimpleTrigger', 0, 0, 0, 2, 0, 0);
%% 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 : 14 == 10MHz (time interval 100ns)
% segment index: 0
[status, timeIntervalNanoSeconds, maxSamples] = invoke(ps5000aDeviceObj, 'ps5000aGetTimebase', 14.5, 0);
%% SET BLOCK PARAMETERS
Nsamples = 1024;
samplingRate = 1/(double(timeIntervalNanoSeconds)*1e-9);
% Set pre-trigger samples.
set(ps5000aDeviceObj, 'numPreTriggerSamples', 0);
set(ps5000aDeviceObj, 'numPostTriggerSamples', Nsamples); %% Samples to record after trigger
%% Start the AWG
% Configure property value(s).
% awgBufferSize = get(ps5000aDeviceObj, 'awgBufferSize');
f = 2.5e6;
t = linspace(0,1/f,Nsamples);
y = normalise(sin(2*pi*f*t));
% load('RF_test_sig.mat');
% y = normalise(RF_test_sig);
% % Set parameters
% % Set the frequency in the Instrument Driver
% set(ps5000aDeviceObj, 'startFrequency', 4*f);
% set(ps5000aDeviceObj, 'stopFrequency', 4*f);
offsetMv = 0;
pkToPkMv = 2000;
increment = 0; % Hz
dwellTime = 1; % seconds
sweepType = ps5000aEnuminfo.enPS5000ASweepType.PS5000A_UP;
operation = PicoConstants.FALSE;
sweepType = ps5000aEnuminfo.enPS5000AIndexMode.PS5000A_SINGLE;
shots = 1;
sweeps = 0;
triggerType = ps5000aEnuminfo.enPS5000ASigGenTrigType.PS5000A_SIGGEN_RISING;
triggerSource = ps5000aEnuminfo.enPS5000ASigGenTrigSource.PS5000A_SIGGEN_SOFT_TRIG;
extInThresholdMv = 0;
% Call function
invoke(ps5000aDeviceObj, 'setSigGenArbitrary', offsetMv, pkToPkMv, increment, dwellTime, ...
y, sweepType, operation, sweepType, shots, sweeps, triggerType, triggerSource, extInThresholdMv);
%% CAPTURE DATA
% Capture a block of data:
% segment index: 0
[status] = invoke(ps5000aDeviceObj, 'runBlock', 0);
% Software trigger the AWG to output a single cycle of the waveform
invoke(ps5000aDeviceObj, 'ps5000aSigGenSoftwareControl', 1);
data_ready = 0;
while(data_ready == 0)
% Wait for data to be collected
fprintf('Waiting for data...................\n');
invoke(ps5000aDeviceObj, 'ps5000aIsReady', data_ready);
end
% 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');
invoke(ps5000aDeviceObj, 'setSigGenOff');
%% 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]);
timeus = timeNs / 1e3;
% Channel A
axisHandleChA = subplot(2,1,1);
plot(timeus, normalise(chA), 'b');
title('Channel A');
xlabel(axisHandleChA, 'Time (us)');
ylabel(axisHandleChA, 'Voltage (mV)');
% original Signal
axisHandleOrig = subplot(2,1,2);
plot(t.*1e6, y, 'r');
title('Original Signal');
xlabel(axisHandleOrig, 'Time (us)');
ylabel(axisHandleOrig, 'Voltage (mV)');
%% DEVICE DISCONNECTION
samplingRate
% Disconnect device object from hardware.
disconnect(ps5000aDeviceObj);
Code: Select all
[status] = invoke(ps5000aDeviceObj, 'runBlock', 0);
Code: Select all
%% LOAD CONFIGURATION INFORMATION
PS5000aConfig;
%% DEVICE CONNECTION
% Create a device object.
ps5000aDeviceObj = icdevice('picotech_ps5000a_generic.mdd');
% Connect device object to hardware.
connect(ps5000aDeviceObj);
%% SET CHANNELS
% Default driver settings used - use ps5000aSetChannel to turn channels on
% or off and set voltage ranges, coupling, as well as analogue offset.
%% SET DEVICE RESOLUTION
% Max. resolution with 2 channels enabled is 15 bits.
[status, resolution] = invoke(ps5000aDeviceObj, 'ps5000aSetDeviceResolution', 14);
%% SET SIMPLE TRIGGER
% Enable : 0 Disable - any non-zero value will trigger
% Channel : 0 (PS5000A_CHANNEL_A)
% Threshold : 0 (mV)
% Direction : 2 (Rising)
% Delay : 0
% Auto trigger: 0 (wait indefinitely)
[status] = invoke(ps5000aDeviceObj, 'setSimpleTrigger', 0, 0, 0, 2, 0, 0);
%% 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 : 14 == 10MHz (time interval 100ns)
% segment index: 0
[status, timeIntervalNanoSeconds, maxSamples] = invoke(ps5000aDeviceObj, 'ps5000aGetTimebase', 14.5, 0);
%% SET BLOCK PARAMETERS
Nsamples = 1024;
samplingRate = 1/(double(timeIntervalNanoSeconds)*1e-9);
% Set pre-trigger samples.
set(ps5000aDeviceObj, 'numPreTriggerSamples', 0);
set(ps5000aDeviceObj, 'numPostTriggerSamples', Nsamples); %% Samples to record after trigger
%% Start the AWG
% Configure property value(s).
% awgBufferSize = get(ps5000aDeviceObj, 'awgBufferSize');
f = 2.5e6;
t = linspace(0,1/f,Nsamples);
y = normalise(sin(2*pi*f*t));
% load('RF_test_sig.mat');
% y = normalise(RF_test_sig);
% % Set parameters
% % Set the frequency in the Instrument Driver
% set(ps5000aDeviceObj, 'startFrequency', 4*f);
% set(ps5000aDeviceObj, 'stopFrequency', 4*f);
offsetMv = 0;
pkToPkMv = 2000;
increment = 0; % Hz
dwellTime = 1; % seconds
sweepType = ps5000aEnuminfo.enPS5000ASweepType.PS5000A_UP;
operation = PicoConstants.FALSE;
sweepType = ps5000aEnuminfo.enPS5000AIndexMode.PS5000A_SINGLE;
shots = 1;
sweeps = 0;
triggerType = ps5000aEnuminfo.enPS5000ASigGenTrigType.PS5000A_SIGGEN_RISING;
triggerSource = ps5000aEnuminfo.enPS5000ASigGenTrigSource.PS5000A_SIGGEN_SOFT_TRIG;
extInThresholdMv = 0;
% Call function
invoke(ps5000aDeviceObj, 'setSigGenArbitrary', offsetMv, pkToPkMv, increment, dwellTime, ...
y, sweepType, operation, sweepType, shots, sweeps, triggerType, triggerSource, extInThresholdMv);
%% CAPTURE DATA
% Capture a block of data:
% segment index: 0
[status] = invoke(ps5000aDeviceObj, 'runBlock', 0);
% Software trigger the AWG to output a single cycle of the waveform
invoke(ps5000aDeviceObj, 'ps5000aSigGenSoftwareControl', 1);
data_ready = 0;
while(data_ready == 0)
% Wait for data to be collected
fprintf('Waiting for data...................\n');
invoke(ps5000aDeviceObj, 'ps5000aIsReady', data_ready);
end
% 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');
invoke(ps5000aDeviceObj, 'setSigGenOff');
%% 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]);
timeus = timeNs / 1e3;
% Channel A
axisHandleChA = subplot(2,1,1);
plot(timeus, normalise(chA), 'b');
title('Channel A');
xlabel(axisHandleChA, 'Time (us)');
ylabel(axisHandleChA, 'Voltage (mV)');
% original Signal
axisHandleOrig = subplot(2,1,2);
plot(t.*1e6, y, 'r');
title('Original Signal');
xlabel(axisHandleOrig, 'Time (us)');
ylabel(axisHandleOrig, 'Voltage (mV)');
%% DEVICE DISCONNECTION
samplingRate
% Disconnect device object from hardware.
disconnect(ps5000aDeviceObj);
Code: Select all
[status] = invoke(ps5000aDeviceObj, 'ps5000aRunBlock', 0, Nsamples, 14.5, 0, 0, 0, 0);
invoke(ps5000aDeviceObj, 'ps5000aSigGenSoftwareControl', 1);
while(data_ready == 0)
fprintf('Waiting for data...................\n');
invoke(ps5000aDeviceObj, 'ps5000aIsReady', data_ready);
end
Code: Select all
[status] = invoke(ps5000aDeviceObj, 'ps5000aRunBlock', 0);
Code: Select all
%% LOAD CONFIGURATION INFORMATION
PS5000aConfig;
%% DEVICE CONNECTION
% Create a device object.
ps5000aDeviceObj = icdevice('picotech_ps5000a_generic.mdd');
% Connect device object to hardware.
connect(ps5000aDeviceObj);
%% SET CHANNELS
% Default driver settings used - use ps5000aSetChannel to turn channels on
% or off and set voltage ranges, coupling, as well as analogue offset.
%% SET DEVICE RESOLUTION
% Max. resolution with 2 channels enabled is 15 bits.
[status, resolution] = invoke(ps5000aDeviceObj, 'ps5000aSetDeviceResolution', 14);
%% SET SIMPLE TRIGGER
% Enable : 0 Disable - any non-zero value will trigger
% Channel : 0 (PS5000A_CHANNEL_A)
% Threshold : 0 (mV)
% Direction : 2 (Rising)
% Delay : 0
% Auto trigger: 0 (wait indefinitely)
[status] = invoke(ps5000aDeviceObj, 'setSimpleTrigger', 0, 0, 0, 2, 0, 0);
%% 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 : 14 == 10MHz (time interval 100ns)
% segment index: 0
[status, timeIntervalNanoSeconds, maxSamples] = invoke(ps5000aDeviceObj, 'ps5000aGetTimebase', 14.5, 0);
%% SET BLOCK PARAMETERS
Nsamples = 1024;
samplingRate = 1/(double(timeIntervalNanoSeconds)*1e-9);
% Set pre-trigger samples.
set(ps5000aDeviceObj, 'numPreTriggerSamples', 0);
set(ps5000aDeviceObj, 'numPostTriggerSamples', Nsamples); %% Samples to record after trigger
%% Start the AWG
% Configure property value(s).
% awgBufferSize = get(ps5000aDeviceObj, 'awgBufferSize');
f = 2.5e6;
t = linspace(0,1/f,Nsamples);
y = normalise(sin(2*pi*f*t));
% load('RF_test_sig.mat');
% y = normalise(RF_test_sig);
% % Set parameters
% % Set the frequency in the Instrument Driver
% set(ps5000aDeviceObj, 'startFrequency', 4*f);
% set(ps5000aDeviceObj, 'stopFrequency', 4*f);
offsetMv = 0;
pkToPkMv = 2000;
increment = 0; % Hz
dwellTime = 1; % seconds
sweepType = ps5000aEnuminfo.enPS5000ASweepType.PS5000A_UP;
operation = PicoConstants.FALSE;
sweepType = ps5000aEnuminfo.enPS5000AIndexMode.PS5000A_SINGLE;
shots = 1;
sweeps = 0;
triggerType = ps5000aEnuminfo.enPS5000ASigGenTrigType.PS5000A_SIGGEN_RISING;
triggerSource = ps5000aEnuminfo.enPS5000ASigGenTrigSource.PS5000A_SIGGEN_SOFT_TRIG;
extInThresholdMv = 0;
% Call function
invoke(ps5000aDeviceObj, 'setSigGenArbitrary', offsetMv, pkToPkMv, increment, dwellTime, ...
y, sweepType, operation, sweepType, shots, sweeps, triggerType, triggerSource, extInThresholdMv);
%% CAPTURE DATA
% Capture a block of data:
% segment index: 0
[status] = invoke(ps5000aDeviceObj, 'ps5000aRunBlock', 0);
% Software trigger the AWG to output a single cycle of the waveform
invoke(ps5000aDeviceObj, 'ps5000aSigGenSoftwareControl', 1);
data_ready = 0;
while(data_ready == 0)
% Wait for data to be collected
fprintf('Waiting for data...................\n');
invoke(ps5000aDeviceObj, 'ps5000aIsReady', data_ready);
end
% 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');
invoke(ps5000aDeviceObj, 'setSigGenOff');
%% 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]);
timeus = timeNs / 1e3;
% Channel A
axisHandleChA = subplot(2,1,1);
plot(timeus, normalise(chA), 'b');
title('Channel A');
xlabel(axisHandleChA, 'Time (us)');
ylabel(axisHandleChA, 'Voltage (mV)');
% original Signal
axisHandleOrig = subplot(2,1,2);
plot(t.*1e6, y, 'r');
title('Original Signal');
xlabel(axisHandleOrig, 'Time (us)');
ylabel(axisHandleOrig, 'Voltage (mV)');
%% DEVICE DISCONNECTION
samplingRate
% Disconnect device object from hardware.
disconnect(ps5000aDeviceObj);
Code: Select all
[status, timeIntervalNanoSeconds, maxSamples] = invoke(ps5000aDeviceObj, 'ps5000aGetTimebase', 14, 0);
set(ps5000aDeviceObj, 'timebase', 14);