Generating A Cw Signal Using Visa And C - Keysight E4428C ESG RF Programming Manual

Signal generators
Table of Contents

Advertisement

Programming Examples
GPIB Programming Interface Examples
getch();
viPrintf(vi, "FREQ:MODE?\n");
viScanf(vi, "%t", rdBuffer);
printf("Source frequency mode is : %s\n", rdBuffer);
printf("Press any key to continue\n");
printf("\n");
getch();
viPrintf(vi, "OUTP OFF\n");
viPrintf(vi, "OUTP?\n");
viScanf(vi, "%1i", &num);
if (num > 0 ) {
printf("Source RF state is : on\n");
}else{
printf("Source RF state is : off\n");
}
viClose(vi);
viClose(defaultRM);
}

Generating a CW Signal Using VISA and C

This example uses VISA library functions to control the signal generator. The signal generator is set
for a CW frequency of 500 kHz and a power level of −2.3 dBm. Launch
Microsoft Visual C++ 6.0, add the required files, and enter the code into your .cpp source file.
visaex4.cpp performs the following functions:
• verifies the GPIB connections and interface are functional
• resets the signal generator
• queries the instrument (CW frequency, power level, frequency mode, and RF state)
• reads responses into the rdBuffer (CW frequency, power level, and frequency mode)
• turns signal generator RF state off
• verifies RF state off
The following program example is available on the signal generator Documentation CD- ROM as
visaex4.cpp.
//****************************************************************************************
// PROGRAM FILE NAME:
//
// PROGRAM DESCRIPTION: This example demonstrates query commands. The signal generator
// frequency and power level.
// The RF state of the signal generator is turn on and then the state is queried. The
// response will indicate that the RF state is on. The RF state is then turned off and
// queried. The response should indicate that the RF state is off. The query results are
94
// Querys the frequency mode
// Reads the response into rdBuffer
// Prints the source freq mode
// Prints new line character to the display
// Turns source RF state off
// Querys the signal generator's RF state
// Reads the response (integer value)
// Prints the on/off RF state
// Close the sessions
visaex4.cpp
Keysight Signal Generators Programming Guide

Advertisement

Table of Contents
loading

Table of Contents