Chapter 2 37
Programming Examples
GPIB Programming Examples
ibwrt(sig, "*RST", 4); // Places signal generator in a defined state
cout << "The signal generator should now be in REMOTE. The remote mode R "<<endl;
cout <<"annunciator should appear on the signal generator display."<<endl;
cout <<"Press Enter to continue"<<endl;
cin.ignore(10000,'\n');
SendIFC(GPIB0); // Resets the GPIB interface
Address[0]=19; // Signal generator's address
Address[1]=NOADDR; // Signifies end element in array. Defined in
// DECL-32.H
SetRWLS(GPIB0, Address); // Places device in Remote with Lockout State.
cout<< "The signal generator should now be in LOCAL LOCKOUT. Verify that all
keys"<<endl;
cout<< "including the 'Local' key are disabled (Contrast keys are not
affected)"<<endl;
cout <<"Press Enter to continue"<<endl;
cin.ignore(10000,'\n');
ibloc(sig); // Returns signal generator to local control
cout<<endl;
cout<<"The signal generator should now be in local mode\n";
return 0;}
}
Queries Using Agilent BASIC
This example demonstrates signal generator query commands. The signal generator can be queried for
conditions and setup parameters. Query commands are identified by the question mark as in the identify
command *IDN?
The following program example is available on the PSG Documentation CD-ROM as basicex3.txt.
10 !********************************************************************************
20 !
30 ! PROGRAM NAME: basicex3.txt
40 !
50 ! PROGRAM DESCRIPTION: In this example, query commands are used with response
60 ! data formats.