Adapt AWG to work with M8199B
Minor changes in Scope Measurement Codes for OFC 2025
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
classdef DC_supply
|
||||
classdef DC_supply < handle
|
||||
% Simple control of DC supply via fixed GBIB address.
|
||||
% Agilent E3646A
|
||||
% No OVP or OCP implementation
|
||||
@@ -8,6 +8,10 @@ classdef DC_supply
|
||||
properties(Access=public)
|
||||
active
|
||||
voltage
|
||||
|
||||
|
||||
meas_voltage
|
||||
meas_current
|
||||
end
|
||||
|
||||
methods (Access=public)
|
||||
@@ -33,6 +37,10 @@ classdef DC_supply
|
||||
|
||||
end
|
||||
|
||||
function v = connectDevice(obj)
|
||||
v = visadev("GPIB1::19::INSTR");
|
||||
end
|
||||
|
||||
function success = set(obj,options)
|
||||
|
||||
|
||||
@@ -44,7 +52,14 @@ classdef DC_supply
|
||||
success = [0,0];
|
||||
|
||||
try
|
||||
%connect to device
|
||||
% %connect to device
|
||||
% if exist('v','var')
|
||||
% %v = visadev("GPIB1::19::INSTR");
|
||||
% v = obj.connectDevice();
|
||||
% else
|
||||
%
|
||||
% end
|
||||
|
||||
v = visadev("GPIB1::19::INSTR");
|
||||
|
||||
debug = 0;
|
||||
@@ -121,5 +136,55 @@ classdef DC_supply
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function [voltage,current] = readVals(obj)
|
||||
|
||||
try
|
||||
%connect to device
|
||||
v = visadev("GPIB1::19::INSTR");
|
||||
|
||||
debug = 0;
|
||||
if debug
|
||||
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
||||
end
|
||||
|
||||
cmd = 'INST:SEL?';
|
||||
writeline(v, cmd);
|
||||
prev_selected_channel = readline(v);
|
||||
|
||||
for ch = 1:2
|
||||
|
||||
% choose channel
|
||||
cmd = ['INST:SEL OUT',num2str(ch)];
|
||||
writeline(v, cmd);
|
||||
|
||||
% get current voltage level
|
||||
cmd = 'VOLT?';
|
||||
writeline(v, cmd);
|
||||
voltage(ch) = str2num(readline(v));
|
||||
|
||||
% get current voltage level
|
||||
cmd = 'MEAS:CURR?';
|
||||
writeline(v, cmd);
|
||||
current(ch) = str2num(readline(v));
|
||||
|
||||
|
||||
end
|
||||
|
||||
% set channel back to prev. selected one
|
||||
cmd = ['INST:SEL ',char(strtrim(prev_selected_channel))];
|
||||
writeline(v, cmd);
|
||||
|
||||
obj.meas_voltage = voltage;
|
||||
obj.meas_current = current;
|
||||
|
||||
%disconnect
|
||||
delete(v);
|
||||
|
||||
catch
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user