MATLAB INSTRUMENT CONTROL TOOLBOX - RELEASE NOTES Bedienungsanleitung Seite 24

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 30
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 23
Using MATLAB's Interface for External Libraries
1MA171_5e Rohde & Schwarz How to use Rohde & Schwarz Instruments in MATLAB
®
24
%% load library of R&S driver
vxipnpLib = 'rsspecan_32';
vxinpnLibDll = 'rsspecan_32.dll';
vxipnpHeader = 'rsspecan.h';
if ~libisloaded (vxipnpLib)
loadlibrary(vxinpnLibDll, vxipnpHeader);
end
%You can use these functions to get information on the functions available in a
library that you have loaded:
%libfunctions(vxipnpLib, '-full');
%libfunctionsview(vxipnpLib);
%
% open VISA session
instr_session = -1;
i
nstr_resource = 'TCPIP::FSV-123123::INSTR';
i
nstr_presource = libpointer( 'int8Ptr', [int8( instr_resource ) 0] );
instr_idQuery = 1;
i
nstr_reset = 1;
%% set up connection
[
err, p8, instr_session] = calllib(vxipnpLib, 'rsspecan_init', instr_presource,
instr_idQuery, instr_reset, instr_session );
if ( err )
error ('Connection to instrument failed')
end
while (true)
%% simple settings
% set instrument to single sweep
instr_window = 1;
instr_sweepModeCont = 0;
instr_numOfSweeps = 1;
[err] = calllib(vxipnpLib, 'rsspecan_ConfigureAcquisition', instr_session,
instr_window, instr_sweepModeCont, instr_numOfSweeps);
if ( err )
break
end
%% example for using attributes
% refer to application note 1MA170 for further details
% configure resolution bandwidth
instr_rbwfreq = 3e3;
% this decimal value is taken from the rsspecan.h file
instr_attr = 1000000+150000+24;
%'RSSPECAN_ATTR_RESOLUTION_BANDWIDTH'; %attribute
instr_repcap = 'Win0'; %repeated capability
instr_prepcap = libpointer( 'int8Ptr', [int8( instr_repcap ) 0] );
[err] = calllib(vxipnpLib, 'rsspecan_SetAttributeViReal64', instr_session,
instr_prepcap, instr_attr, instr_rbwfreq);
if ( err )
break
end
% configure sweep points
instr_window = 1;
instr_sweepPoints = 501;
[err] = calllib(vxipnpLib, 'rsspecan_ConfigureSweepPoints', instr_session,
instr_window, instr_sweepPoints);
if ( err )
break
end
% configure RF parameters
instr_freqCenter = 1.1e9;
instr_freqSpan = 1e6;
[err] = calllib(vxipnpLib, 'rsspecan_ConfigureFrequencyCenterSpan',
instr_session, instr_window, instr_freqCenter, instr_freqSpan);
if ( err )
Seitenansicht 23
1 2 ... 19 20 21 22 23 24 25 26 27 28 29 30

Kommentare zu diesen Handbüchern

Keine Kommentare