Queries for gpib using visa and c – Agilent Technologies N5183A MXG User Manual
Page 85
![background image](/manuals/34672/85/background.png)
Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
75
Programming Examples
GPIB Programming Interface Examples
rdVal[ibcntl] = '\0'; // Null character indicating end of array
// Prints signal generator power level
cout<<"Source power (dBm) is : "< cout<<"Press any key to continue"< cin.ignore(10000,'\n'); ibwrt(sig, ":FREQ:MODE?",11); // Querys source frequency mode ibrd(sig, rdVal,100); // Enters in the source frequency mode rdVal[ibcntl] = '\0'; // Null character indicating end of array cout<<"Source frequency mode is "< cout<<"Press any key to continue"< cin.ignore(10000,'\n'); ibwrt(sig, "OUTP OFF",12); // Turns off RF source ibwrt(sig, "OUTP?",5); // Querys the on/off state of the instrument ibrd(sig,rdVal,2); // Enter in the source state rdVal[ibcntl] = '\0'; num = (int (rdVal[0]) -('0')); if (num > 0){ cout<<"Source RF state is : On"< }else{ cout<<"Source RF state is : Off"< cout< ibwrt(sig, "*IDN?",5); // Querys the instrument ID ibrd(sig, rdVal,100); // Reads the source ID rdVal[ibcntl] = '\0'; // Null character indicating end of array cout<<"Source ID is : "< cout<<"Press any key to continue"< 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 : "< cout< cout<<"Press the 'Local' key to return the signal generator to LOCAL control”< cout< return 0; } Queries for GPIB Using VISA and C This example uses VISA library functions to query different instrument states and conditions. Launch • verifies the GPIB connections and interface are functional
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: