Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide 85
Programming Examples
GPIB Programming Interface Examples
ibrd(sig, rdVal,100); // Reads the source ID
rdVal[ibcntl] = '\0'; // Null character indicating end
of array
cout<<"Source ID is : "<<rdVal; // Prints the source ID
cout<<"Press any key to continue"<<endl;
cin.ignore(10000,'\n');
ibwrt(sig, "SYST:COMM:GPIB:ADDR?",20); //Querys source address
ibrd(sig, rdVal,100); // Reads the source address
rdVal[ibcntl] = '\0'; // Null character indicates end of
array
// Prints the signal generator
address
cout<<"Source GPIB address is : "<<rdVal;
cout<<endl;
cout<<"Press the 'Local' key to return the signal generator to
LOCAL control”<<endl; cout<<endl;
return 0;
}
Queries for GPIB Using VISA and C
This example uses VISA library functions to query different instrument states
and conditions. Launch Microsoft Visual C++ 6.0, add the required files, and
enter the following code into your .cpp source file.
visaex3.cpp
performs the
following functions:
— verifies the GPIB connections and interface are functional
— resets the signal generator
— queries the instrument (CW frequency, power level, frequency mode, and
RF state)
— reads responses into the rdBuffer (CW frequency, power level, and
frequency mode)
— turns signal generator RF state off
— verifies RF state off
The following program example is available on the signal generator
Documentation CD-ROM as
visaex3.cpp
.
//*****************************************************************
// PROGRAM FILE NAME:visaex3.cpp
//
// PROGRAM DESCRIPTION:This example demonstrates the use of query
commands. The signal
Содержание X-Series
Страница 4: ...4 ...
Страница 10: ...10 Contents ...