Queries For Gpib Using Visa And C - Keysight E4428C ESG RF Programming Manual

Signal generators
Table of Contents

Advertisement

Programming Examples
GPIB Programming Interface Examples
ibwrt(sig, "OUTP?",5);
ibrd(sig,rdVal,2);
rdVal[ibcntl] = '\0';
num = (int (rdVal[0]) -('0'));
if (num > 0){
cout<<"Source RF state is : On"<<endl;
}else{
cout<<"Source RF state is : Off"<<endl;}
cout<<endl;
ibwrt(sig, "*IDN?",5);
ibrd(sig, rdVal,100);
rdVal[ibcntl] = '\0';
cout<<"Source ID is : "<<rdVal;
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);
rdVal[ibcntl] = '\0';
cout<<"Source GPIB address is : "<<rdVal;
cout<<endl;
cout<<"Press the 'Local' key to return the signal generator to LOCAL control"<<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
// generator can be queried for conditions and instrument states. These commands are of
// the type "*IDN?"; the question mark indicates a query.
92
// Querys the on/off state of the instrument
// Enter in the source state
// Querys the instrument ID
// Reads the source ID
// Null character indicating end of array
// Prints the source ID
// Reads the source address
// Null character indicates end of array
// Prints the signal generator address
Keysight Signal Generators Programming Guide
cout<<endl;

Advertisement

Table of Contents
loading

Table of Contents