Keysight E4428C ESG RF Programming Manual page 101

Signal generators
Table of Contents

Advertisement

//
//****************************************************************************************
#include <visa.h>
#include "StdAfx.h"
#include <iostream>
#include <conio.h>
#include <stdlib.h>
using namespace std;
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:CW?\n");
viScanf(vi, "%t", rdBuffer);
printf("Source CW frequency is : %s\n", rdBuffer);
printf("Press any key to continue\n");
printf("\n");
getch();
viPrintf(vi, "POW:AMPL?\n");
viScanf(vi, "%t", rdBuffer);
printf("Source power (dBm) is : %s\n", rdBuffer);
printf("Press any key to continue\n");
printf("\n");
Keysight Signal Generators Programming Guide
// Declares variables of type ViSession
// for instrument communication
// Declares a variable of type ViStatus
// for GPIB verifications
// Declares variable to hold string data
// Declares variable to hold integer data
// Initialize the VISA system
// Open session to GPIB device at address 19
// If problems, then prompt user
// Resets signal generator
// Querys the CW frequency
// Reads response into rdBuffer
// Prints the source frequency
// Prints new line character to the display
// Querys the power level
// Reads the response into rdBuffer
// Prints the source power level
// Prints new line character to the display
Programming Examples
GPIB Programming Interface Examples
93

Advertisement

Table of Contents
loading

Table of Contents