Skip to content

Commit 1cb31f7

Browse files
author
neil.hamilton
committed
Create PS6000A_ID_Block_Example.m
1 parent 398e994 commit 1cb31f7

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
%% PicoScope 6000 Series (A API) Instrument Driver Oscilloscope Block Data Capture Example
2+
% This is an example of an instrument control session using a device
3+
% object. The instrument control session comprises all the steps you
4+
% are likely to take when communicating with your instrument.
5+
%
6+
% These steps are:
7+
%
8+
% # Create a device object
9+
% # Connect to the instrument
10+
% # Configure properties
11+
% # Invoke functions
12+
% # Disconnect from the instrument
13+
%
14+
% To run the instrument control session, type the name of the file,
15+
% PS6000A_ID_Block_Example, at the MATLAB command prompt.
16+
%
17+
% The file, PS6000A_ID_BLOCK_EXAMPLE.M must be on your MATLAB PATH. For
18+
% additional information on setting your MATLAB PATH, type 'help addpath'
19+
% at the MATLAB command prompt.
20+
%
21+
% *Example:*
22+
% PS6000A_ID_Block_Example;
23+
%
24+
% *Description:*
25+
% Demonstrates how to set properties and call functions in order to
26+
% capture a block of data from a PicoScope 6000 (A API) Series Oscilloscope.
27+
%
28+
% *See also:* <matlab:doc('icdevice') |icdevice|> | <matlab:doc('instrument/invoke') |invoke|>
29+
%
30+
% *Copyright:* © 2020 Pico Technology Ltd. See LICENSE file for terms.
31+
32+
%% Suggested Input Settings
33+
34+
%% Clear Command Window and Close Figures
35+
36+
clc;
37+
close all;
38+
39+
%% Load Configuration Information
40+
41+
[ps6000aStructs, ps6000aEnumInfo]=PS6000aSetConfig();
42+
43+
%% Device Connection
44+
45+
% Check if an Instrument session using the device object 'ps6000DeviceObj'
46+
% is still open, and if so, disconnect if the User chooses 'Yes' when prompted.
47+
if (exist('ps6000aDeviceObj', 'var') && ps6000aDeviceObj.isvalid && strcmp(ps6000aDeviceObj.status, 'open'))
48+
49+
openDevice = questionDialog(['Device object ps6000aDeviceObj has an open connection. ' ...
50+
'Do you wish to close the connection and continue?'], ...
51+
'Device Object Connection Open');
52+
53+
if (openDevice == PicoConstants.TRUE)
54+
55+
% Close connection to device
56+
disconnect(ps6000aDeviceObj);
57+
delete(ps6000aDeviceObj);
58+
59+
else
60+
61+
% Exit script if User selects 'No'
62+
return;
63+
64+
end
65+
66+
end
67+
68+
%% Create a device object.
69+
% The serial number can be specified as a second input parameter.
70+
ps6000aDeviceObj = icdevice('picotech_ps6000a_generic.mdd','');

0 commit comments

Comments
 (0)