Technical data
Agilent Signal Generators Programming Guide 95
Programming Examples
GPIB Programming Interface Examples
printf("Source RF state is : on\n");
}else{
printf("Source RF state is : off\n");
}
printf("\n");
printf("Verify RF state then press continue\n");
printf("\n");
getch();
viClear(vi);
viPrintf(vi,"OUTP:STAT OFF\n"); // Turn source RF state off
viPrintf(vi, "OUTP?\n"); // Query the signal generator's RF state
viScanf(vi, "%1i", &num); // Read the response
// Print the on/off RF state
if (num > 0 ) {
printf("Source RF state is now: on\n");
}else{
printf("Source RF state is now: off\n");
}
// Close the sessions
printf("\n");
viClear(vi);
viClose(vi);
viClose(defaultRM);
}
Generating an Externally Applied AC-Coupled FM Signal Using VISA and C
In this example, the VISA library is used to generate an ac- coupled FM signal at a carrier frequency
of 700 MHz, a power level of −2.5 dBm, and a deviation of 20 kHz. Before running the program:
• Connect the output of a modulating signal source to the signal generator’s EXT 2 input connector.
• Set the modulation signal source for the desired FM characteristics.
Launch Microsoft Visual C++ 6.0, add the required files, and enter the code into your .cpp source file.
visaex5.cpp performs the following functions:
• error checking
• resets the signal generator
• sets up the EXT 2 connector on the signal generator for FM
• sets up FM path 2 coupling to AC
• sets up FM path 2 deviation to 20 kHz
• sets carrier frequency to 700 MHz
• sets the power level to - 2.5 dBm
• turns on frequency modulation and RF output
The following program example is available on the signal generator Documentation CD- ROM as
visaex5.cpp.
//****************************************************************************************