Keysight E4428C ESG RF Programming Manual page 103

Signal generators
Table of Contents

Advertisement

// printed to the to the display window.
//
//****************************************************************************************
#include "StdAfx.h"
#include <visa.h>
#include <iostream>
#include <stdlib.h>
#include <conio.h>
void main ()
{
ViSession
defaultRM, vi;
ViStatus viStatus = 0;
char rdBuffer [256];
int num;
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");
viPrintf(vi, "FREQ 500 kHz\n"); // Set the source CW frequency for 500 kHz
viPrintf(vi, "FREQ:CW?\n");
viScanf(vi, "%t", rdBuffer);
printf("Source CW frequency is : %s\n", rdBuffer);
viPrintf(vi, "POW:AMPL -2.3 dBm\n");
viPrintf(vi, "POW:AMPL?\n");
viScanf(vi, "%t", rdBuffer);
printf("Source power (dBm) is : %s\n", rdBuffer); // Print the power level
viPrintf(vi, "OUTP:STAT ON\n"); // Turn source RF state on
viPrintf(vi, "OUTP?\n");
viScanf(vi, "%1i", &num);
// Print the on/off RF state
if (num > 0 ) {
Keysight Signal Generators Programming Guide
// Declares variables of type ViSession
// for instrument communication
// Declares a variable of type ViStatus
// for GPIB verifications
// Declare variable to hold string data
// Declare variable to hold integer data
// Initialize VISA system
// Open session to GPIB device at address 19
// If problems then prompt user
// Reset the signal generator
// Query the CW frequency
// Read signal generator response
// Print the frequency
// Set the power level to -2.3 dBm
// Query the power level
// Read the response into rdBuffer
// Query the signal generator's RF state
// Read the response (integer value)
Programming Examples
GPIB Programming Interface Examples
95

Advertisement

Table of Contents
loading

Table of Contents