34 Chapter 2
Programming Examples
GPIB Programming Examples
void main ()
{
ViSession defaultRM, vi; // Declares a variable of type ViSession
// for instrument communication
ViStatus viStatus = 0;
// Opens a session to the GPIB device
// at address 19
viStatus=viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM, "GPIB::19::INSTR", VI_NULL, VI_NULL, &vi);
if(viStatus){
printf("Could not open ViSession!\n");
printf("Check instruments and connections\n");
printf("\n");
exit(0);}
viPrintf(vi, "*RST\n"); // initializes signal generator
// prints to the output window
printf("The signal generator should now be in REMOTE. The remote
indicator\n");
printf("annunciator R should appear on the signal generator display\n");
printf("\n");
viClose(vi); // closes session
viClose(defaultRM); // closes default session
}
Local Lockout Using Agilent BASIC
This example demonstrates the Local Lockout function. Local Lockout disables the front panel signal
generator keys.
The following program example is available on the PSG Documentation CD-ROM as basicex2.txt.
10 !*************************************************************************
20 !
30 ! PROGRAM NAME: basicex2.txt