Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide 87
Programming Examples
GPIB Programming Interface Examples
exit(0);}
viPrintf(vi, "*RST\n"); // Resets signal generator
viPrintf(vi, "FREQ:CW?\n"); // Querys the CW frequency
viScanf(vi, "%t", rdBuffer); // Reads response into rdBuffer
// Prints the source frequency
printf("Source CW frequency is : %s\n", rdBuffer);
printf("Press any key to continue\n");
printf("\n"); // Prints new line character to
the display
getch();
viPrintf(vi, "POW:AMPL?\n"); // Querys the power level
viScanf(vi, "%t", rdBuffer); // Reads the response into
rdBuffer
// Prints the source power level
printf("Source power (dBm) is : %s\n", rdBuffer);
printf("Press any key to continue\n");
printf("\n"); // Prints new line character to
the display
getch();
viPrintf(vi, "FREQ:MODE?\n"); // Querys the frequency mode
viScanf(vi, "%t", rdBuffer); // Reads the response into
rdBuffer
// Prints the source freq mode
printf("Source frequency mode is : %s\n", rdBuffer);
printf("Press any key to continue\n");
printf("\n"); // Prints new line character to
the display
getch();
viPrintf(vi, "OUTP OFF\n"); // Turns source RF state off
viPrintf(vi, "OUTP?\n"); // Querys the signal generator's
RF state
viScanf(vi, "%1i", &num); // Reads the response (integer
value)
// Prints the on/off RF state
if (num > 0 ) {
printf("Source RF state is : on\n");
Summary of Contents for X-Series
Page 4: ...4 ...
Page 10: ...10 Contents ...