
Using the Instrument Control Toolbox
1MA171_5e Rohde & Schwarz How to use Rohde & Schwarz Instruments in MATLAB
®
14
2.7 Application Example for the 32-bit rsspecan
Instrument Driver
%% Rohde & Schwarz GmbH & Co. KG
% MATLAB Instrument Control Toolbox example for R&S Specturm
% Analyzer Instrument Driver (rsspecan)
%
% Purpose: Test for rsspecan VXIplug&play instrument
% The driver configures a read trace measurement example
% Author: Juergen Engelbrecht, customersupport@rohde-schwarz.com
%% cleanup possible open connections
i
nstrreset;
try
%
% open driver session
% create a device object.
deviceObj = icdevice('rsspecan.mdd',
'TCPIP::FSV-123123::instr0::INSTR');
% connect device object to hardware.
connect(deviceObj)
% reset instrument
devicereset(deviceObj);
catch MException
%% cleanup driver session
% delete object
delete(deviceObj);
error('Connection to instrument failed')
end
try
%% example for using attributes
% configure center frequency
instr_cfrequency = 2e9;
% this decimal value is taken from the rsspecan.h file
instr_attr = 1000000+150000+9; %'RSSPECAN_ATTR_FREQUENCY_CENTER';
%attribute
instr_repcap = 'Win0'; %repeated capability
groupObj = get(deviceObj, 'ConfigurationSetGetCheckAttributeSetAttribute');
groupObj = groupObj(1);
invoke(groupObj, 'setattributevireal64', instr_repcap, instr_attr,
instr_cfrequency);
%% simple settings
% set instrument to single sweep
instr_window = 1;
instr_sweepModeCont = 0;
instr_numOfSweeps = 1;
groupObj = get(deviceObj, 'Configuration');
groupObj = groupObj(1);
invoke(groupObj, 'configureacquisition', instr_window, instr_sweepModeCont,
instr_numOfSweeps);
% configure sweep points
instr_sweepPoints = 501;
groupObj = get(deviceObj, 'Configuration');
groupObj = groupObj(1);
invoke(groupObj, 'configuresweeppoints', instr_window, instr_sweepPoints);
% configure RF parameters
instr_freqCenter = 1.1e9;
instr_freqSpan = 1e6;
groupObj = get(deviceObj, 'Configuration');
groupObj = groupObj(1);
invoke(groupObj, 'configurefrequencycenterspan', instr_window,
instr_freqCenter, instr_freqSpan);
Komentarze do niniejszej Instrukcji