PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
clc;
clear all;
close all;
loadlibrary 'PS5000.dll' 'ps5000Api.h' addheader 'picoStatus.h' mfilename 'PS5000MFile';
if ~libisloaded('PS5000')
error('library PS5000.dll or PS5000.h not found') %check if the library is loaded
end
Buffer = zeros(1,1000000);
[methodinfo,structs,enuminfo] = PS5000MFile; % Data and method structure for the ps5000 api.
unithandle = 0; % Handle to the opened unit.
offsetVoltage = 0; % Offset in microvolt (±1 V).
pkToPk = 500000; % Peak-to-peak amplitude in microvolt (±250 mV to ±2 V).
waveType = enuminfo.enWaveType.PS5000_SINE; % Type of Wave. See commentsection at the bottom of this file for a full list.
%waveType = 'PS5000_SINE'; % Type of Wave. See commentsection at the bottom of this file for a full list.
startFrequency = 1000; % Hz (must be lower than or equal to stopfrequency).
stopFrequency = 1000; % Hz.
increment = 0; % Increment in frequency for sweepmode.
dwellTime = 0; % Time (sec) spent in each frequency for sweepmode.
sweepType = 'UP'; % Type of sweep. See commentsection at the bottom of this file for a full list.
whiteNoise = 0; % TRUE or FALSE.
shots = 0; % Number of shots if not in sweepmode.
sweeps = 0; % Number of sweeps if in sweepmode.
triggerType = 'SIGGEN_RISING'; % Trigger type. See commentsection at the bottom of this file for a full list.
triggerSource = 'SIGGEN_NONE'; % Trigger source. See commentsection at the bottom of this file for a full list.
extInThreshold = 0; % Threshold for trigger on external in.
[status_open,unithandle] = calllib('PS5000','ps5000OpenUnit',unithandle);
status_ps5000SetChannel = calllib('PS5000','ps5000SetChannel',unithandle,'PS5000_CHANNEL_A',true,true,'PS5000_500MV');
status_ps5000GetTimebase = calllib('PS5000','ps5000GetTimebase',unithandle,2500002,1000000,0,1,0,0);
status_SetSigGenBuiltIn = calllib('PS5000','ps5000SetSigGenBuiltIn',unithandle,...
offsetVoltage,pkToPk,waveType,startFrequency,stopFrequency,increment,dwellTime,...
sweepType,whiteNoise,shots,sweeps,triggerType,triggerSource,extInThreshold);
status_ps5000RunBlock = calllib('PS5000','ps5000RunBlock',unithandle,0,0,2500002,1,0,10000,0,0);
pause(0.5);
status_ps5000SetDataBuffer = calllib('PS5000','ps5000SetDataBuffer',unithandle,'PS5000_CHANNEL_A',Buffer,1000000);
status_ps5000GetValues = calllib('PS5000','ps5000GetValues',unithandle,0,1000000,0,1,10000,0);
plot(status_ps5000GetValues)
status_close = calllib('PS5000','ps5000CloseUnit',unithandle);
unloadlibrary('PS5000');
[/codeclc;
clear all;
close all;
loadlibrary 'PS5000.dll' 'ps5000Api.h' addheader 'picoStatus.h' mfilename 'PS5000MFile';
if ~libisloaded('PS5000')
error('library PS5000.dll or PS5000.h not found') %check if the library is loaded
end
Buffer = zeros(1,1000000);
[methodinfo,structs,enuminfo] = PS5000MFile; % Data and method structure for the ps5000 api.
unithandle = 0; % Handle to the opened unit.
offsetVoltage = 0; % Offset in microvolt (±1 V).
pkToPk = 500000; % Peak-to-peak amplitude in microvolt (±250 mV to ±2 V).
waveType = enuminfo.enWaveType.PS5000_SINE; % Type of Wave. See commentsection at the bottom of this file for a full list.
%waveType = 'PS5000_SINE'; % Type of Wave. See commentsection at the bottom of this file for a full list.
startFrequency = 1000; % Hz (must be lower than or equal to stopfrequency).
stopFrequency = 1000; % Hz.
increment = 0; % Increment in frequency for sweepmode.
dwellTime = 0; % Time (sec) spent in each frequency for sweepmode.
sweepType = 'UP'; % Type of sweep. See commentsection at the bottom of this file for a full list.
whiteNoise = 0; % TRUE or FALSE.
shots = 0; % Number of shots if not in sweepmode.
sweeps = 0; % Number of sweeps if in sweepmode.
triggerType = 'SIGGEN_RISING'; % Trigger type. See commentsection at the bottom of this file for a full list.
triggerSource = 'SIGGEN_NONE'; % Trigger source. See commentsection at the bottom of this file for a full list.
extInThreshold = 0; % Threshold for trigger on external in.
[status_open,unithandle] = calllib('PS5000','ps5000OpenUnit',unithandle);
status_ps5000SetChannel = calllib('PS5000','ps5000SetChannel',unithandle,'PS5000_CHANNEL_A',true,true,'PS5000_500MV');
status_ps5000GetTimebase = calllib('PS5000','ps5000GetTimebase',unithandle,2500002,1000000,0,1,0,0);
status_SetSigGenBuiltIn = calllib('PS5000','ps5000SetSigGenBuiltIn',unithandle,...
offsetVoltage,pkToPk,waveType,startFrequency,stopFrequency,increment,dwellTime,...
sweepType,whiteNoise,shots,sweeps,triggerType,triggerSource,extInThreshold);
status_ps5000RunBlock = calllib('PS5000','ps5000RunBlock',unithandle,0,0,2500002,1,0,10000,0,0);
pause(0.5);
status_ps5000SetDataBuffer = calllib('PS5000','ps5000SetDataBuffer',unithandle,'PS5000_CHANNEL_A',Buffer,1000000);
status_ps5000GetValues = calllib('PS5000','ps5000GetValues',unithandle,0,1000000,0,1,10000,0);
status_close = calllib('PS5000','ps5000CloseUnit',unithandle);
unloadlibrary('PS5000');
Code: Select all
libfunctionsview('PS5000');
Code: Select all
pBufferChA = libpointer('int16Ptr', zeros(1000000, 1));
The number of samples is determined by noOfPreTriggerSamples and noOfPostTriggerSamples
Code: Select all
noOfPreTriggerSamples = 0;
noOfPostTriggerSamples = 1000000;
timebase = 2500002;
oversample = 1;
timeIndisposedMs = [];
segmentIndex = 0; % Leave set to 0 unless the data is being captured in a specific segment on the device.
lpReady = []; % Callback not used
pParameter = [];
status_ps5000RunBlock = calllib('PS5000','ps5000RunBlock',unithandle, noOfPreTriggerSamples, noOfPostTriggerSamples, timebase, oversample, timeIndisposedMs, segmentIndex, lpReady, pParameter);
ready = 0;
% Poll the driver until it has captured some data
while(ready == 0)
[status_read, ready] = calllib('PS5000', 'ps5000IsReady', unithandle, ready);
pause(0.1);
end
Code: Select all
bufferChA = get(pBufferChA, 'Value');
Code: Select all
clc;
clear all;
close all;
loadlibrary 'PS5000.dll' 'ps5000Api.h' addheader 'picoStatus.h' mfilename 'PS5000MFile';
if ~libisloaded('PS5000')
error('library PS5000.dll or PS5000.h not found') %check if the library is loaded
end
pBufferChA = libpointer('int16Ptr', zeros(1000000, 1));
[methodinfo,structs,enuminfo] = PS5000MFile; % Data and method structure for the ps5000 api.
unithandle = 0; % Handle to the opened unit.
offsetVoltage = 0; % Offset in microvolt (±1 V).
pkToPk = 500000; % Peak-to-peak amplitude in microvolt (±250 mV to ±2 V).
waveType = enuminfo.enWaveType.PS5000_SINE; % Type of Wave. See commentsection at the bottom of this file for a full list.
%waveType = 'PS5000_SINE'; % Type of Wave. See commentsection at the bottom of this file for a full list.
startFrequency = 1000; % Hz (must be lower than or equal to stopfrequency).
stopFrequency = 1000; % Hz.
increment = 0; % Increment in frequency for sweepmode.
dwellTime = 0; % Time (sec) spent in each frequency for sweepmode.
sweepType = 'UP'; % Type of sweep. See commentsection at the bottom of this file for a full list.
whiteNoise = 0; % TRUE or FALSE.
shots = 0; % Number of shots if not in sweepmode.
sweeps = 0; % Number of sweeps if in sweepmode.
triggerType = 'SIGGEN_RISING'; % Trigger type. See commentsection at the bottom of this file for a full list.
triggerSource = 'SIGGEN_NONE'; % Trigger source. See commentsection at the bottom of this file for a full list.
extInThreshold = 0; % Threshold for trigger on external in.
noOfPreTriggerSamples = 0;
noOfPostTriggerSamples = 1000000;
timebase = 2500002;
oversample = 1;
timeIndisposedMs = [];
segmentIndex = 0; % Leave set to 0 unless the data is being captured in a specific segment on the device.
lpReady = []; % Callback not used
pParameter = [];
[status_open,unithandle] = calllib('PS5000','ps5000OpenUnit',unithandle);
status_ps5000SetChannel = calllib('PS5000','ps5000SetChannel',unithandle,'PS5000_CHANNEL_A',true,true,'PS5000_500MV');
status_ps5000GetTimebase = calllib('PS5000','ps5000GetTimebase',unithandle,2500002,1000000,0,1,0,0);
status_SetSigGenBuiltIn = calllib('PS5000','ps5000SetSigGenBuiltIn',unithandle,...
offsetVoltage,pkToPk,waveType,startFrequency,stopFrequency,increment,dwellTime,...
sweepType,whiteNoise,shots,sweeps,triggerType,triggerSource,extInThreshold);
status_ps5000RunBlock = calllib('PS5000','ps5000RunBlock',unithandle, noOfPreTriggerSamples,...
noOfPostTriggerSamples, timebase, oversample, timeIndisposedMs, segmentIndex, lpReady, pParameter);
status_ps5000SetDataBuffer = calllib('PS5000','ps5000SetDataBuffer',unithandle,'PS5000_CHANNEL_A',pBufferChA,1000000);
status_ps5000GetValues = calllib('PS5000','ps5000GetValues',unithandle,0,1000000,0,'RATIO_MODE_NONE',0,0);
bufferChA = get(pBufferChA, 'Value')
status_close = calllib('PS5000','ps5000CloseUnit',unithandle);
unloadlibrary('PS5000');
Code: Select all
clc;
clear all;
close all;
loadlibrary 'PS5000.dll' 'ps5000Api.h' addheader 'picoStatus.h' mfilename 'PS5000MFile';
if ~libisloaded('PS5000')
error('library PS5000.dll or PS5000.h not found') %check if the library is loaded
end
pBufferChA = libpointer('int16Ptr', zeros(1000000, 1));
[methodinfo,structs,enuminfo] = PS5000MFile; % Data and method structure for the ps5000 api.
unithandle = 0; % Handle to the opened unit.
offsetVoltage = 0; % Offset in microvolt (±1 V).
pkToPk = 500000; % Peak-to-peak amplitude in microvolt (±250 mV to ±2 V).
waveType = enuminfo.enWaveType.PS5000_SINE; % Type of Wave. See commentsection at the bottom of this file for a full list.
%waveType = 'PS5000_SINE'; % Type of Wave. See commentsection at the bottom of this file for a full list.
startFrequency = 1000; % Hz (must be lower than or equal to stopfrequency).
stopFrequency = 1000; % Hz.
increment = 0; % Increment in frequency for sweepmode.
dwellTime = 0; % Time (sec) spent in each frequency for sweepmode.
sweepType = 'UP'; % Type of sweep. See commentsection at the bottom of this file for a full list.
whiteNoise = 0; % TRUE or FALSE.
shots = 0; % Number of shots if not in sweepmode.
sweeps = 0; % Number of sweeps if in sweepmode.
triggerType = 'SIGGEN_RISING'; % Trigger type. See commentsection at the bottom of this file for a full list.
triggerSource = 'SIGGEN_NONE'; % Trigger source. See commentsection at the bottom of this file for a full list.
extInThreshold = 0; % Threshold for trigger on external in.
noOfPreTriggerSamples = 0;
noOfPostTriggerSamples = 1000000;
timebase = 2500002;
oversample = 1;
timeIndisposedMs = [];
segmentIndex = 0; % Leave set to 0 unless the data is being captured in a specific segment on the device.
lpReady = []; % Callback not used
pParameter = [];
overflow = [];
channelA = enuminfo.enPS5000Channel.PS5000_CHANNEL_A;
range = enuminfo.enPS5000Range.PS5000_500MV;
downSampleRatioMode = enuminfo.enRatioMode.RATIO_MODE_NONE;
true = enuminfo.enTriggerState.CONDITION_TRUE;
[status_open,unithandle] = calllib('PS5000','ps5000OpenUnit',unithandle);
status_ps5000SetChannel = calllib('PS5000','ps5000SetChannel',unithandle,channelA,true,true,range);
status_ps5000GetTimebase = calllib('PS5000','ps5000GetTimebase',unithandle,2500002,1000000,0,oversample,1000000,0);
status_SetSigGenBuiltIn = calllib('PS5000','ps5000SetSigGenBuiltIn',unithandle,...
offsetVoltage,pkToPk,waveType,startFrequency,stopFrequency,increment,dwellTime,...
sweepType,whiteNoise,shots,sweeps,triggerType,triggerSource,extInThreshold);
status_ps5000RunBlock = calllib('PS5000','ps5000RunBlock',unithandle, noOfPreTriggerSamples,...
noOfPostTriggerSamples, timebase, oversample, timeIndisposedMs, segmentIndex, lpReady, pParameter);
status_ps5000SetDataBuffer = calllib('PS5000','ps5000SetDataBuffer',unithandle,channelA,pBufferChA,1000000);
status_ps5000GetValues = calllib('PS5000','ps5000GetValues',unithandle,0,1000000,0,downSampleRatioMode,0,overflow);
bufferChA = get(pBufferChA, 'Value')
status_close = calllib('PS5000','ps5000CloseUnit',unithandle);
unloadlibrary('PS5000');
Hope this helps,1. Open the oscilloscope using ps5000OpenUnit .
2. Select channel ranges and AC/DC coupling using ps5000SetChannel .
3. Using ps5000GetTimebase , select timebases until the required nanoseconds
per sample is located.
4. If you require ETS mode, set it up using ps5000SetEts .
5. If you are using ETS mode, allocate timing information buffers and tell the driver
about them using ps5000SetEtsTimeBuffer .
6. Use the trigger setup functions to set up the trigger if required.
7. If required, set the signal generator using ps5000SetSigGen .
8. Start the oscilloscope running using ps5000RunBlock .
9. Wait until the oscilloscope is ready [...].
10. Use ps5000SetDataBuffer to tell the driver where your memory buffer is.
11. Transfer the block of data from the oscilloscope using ps5000GetValues .
12. Display the data.
13. Repeat steps 8 to 12.
14. Stop the oscilloscope using ps5000Stop