4 Programming example
4.1 Basic operation example
102
Add Deci-32.h file to the header file.
More detailed information on the NI-488.2 library and the VISA library is available on National
Instruments and Keysight websites respectively.
4.1.3 Initialization and default status setting
When the program starts, firstly initialize VISA resource manager, and then enable and establish the
communication connection between VISA library and the instrument. The specific steps are as follows:
4.1.3.1 Generation of global variable
Firstly, generate the global variable to be recalled by other program modules, such as the instrument
handle variable. The following example program shall contain the following global variables:
ViSession vi3986;
ViSession defaultRM;
char analyzerString [VI_FIND_BUFLEN] = "GPIB0::8::INSTR";
const analyzerTimeout = 10000;
Where the constant analyzerString represents the instrument descriptor, “GPIB0” represents the
controller, and “8” represents the instrument connected to the controller. If it is assumed that the
instrument is connecte
d to the LAN and the IP address is “172.141.114.254”, the value of this variable is:
char analyzerString [VI_FIND_BUFLEN] = "TCPIP0::172.141.114.254::5000::SOCKET";
4.1.3.2 Controller initialization
/*************************************************************************
The following example shows how to open and establish a communication connection between VISA
library and the instrument (specified by instrument descriptor).
Initialize controller: open the default explorer and return the instrument handle vi3986
*************************************************************************/
void InitController()
{
ViStatus status;
status = viOpenDefaultRM(&defaultRM);
status = viOpen(defaultRM, analyzerString, VI_NULL, VI_NULL, &vi3986);
}
4.1.3.3 Instrument initialization
/*************************************************************************
The following example shows how to initialize the instrument default status and clear status registers.
*************************************************************************/
void InitDevice()
{
ViStatus status;
long retCnt;
status = viWrite(vi3986, (ViBuf)"*CLS", 4, (ViPUInt32)&retCnt); //reset status registers
status = viWrite(vi3986, (ViBuf)"*RST", 4, (ViPUInt32)&retCnt); //reset the instrument
status = viWrite(vi3986,(ViBuf)"INST:SEL SAN", 12, (ViPUInt32)&retCnt); //set the working mode of
Содержание 3986 Series
Страница 1: ...3986 Series Noise Figure Analyzer Programming Manual...
Страница 4: ......
Страница 8: ...3986 Series noise figure analyzer Table of Contents 4...
Страница 107: ...3 SCPI 3 3 Instrument specific Commands 99...
Страница 119: ...4 Programming example 4 2 Advanced operation example 111...