Keysight E4428C ESG RF Programming Manual page 277

Signal generators
Table of Contents

Advertisement

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
// Choose a GPIB, LAN, or RS-232 connection
char* instOpenString ="lan[galqaDhcp1]";
//char* instOpenString ="gpib0,19";
// Pick some maximum number of samples, based on the
// amount of memory in your computer and the signal generator.
const int NUMSAMPLES=500;
int main(int argc, char* argv[])
{
// Create a text file to view the waveform
// prior to downloading it to the signal generator.
// This verifies that the data looks correct.
char *ofile = "c:\\temp\\iq.txt";
// Create arrays to hold the I and Q data
int idata[NUMSAMPLES];
int qdata[NUMSAMPLES];
// save the number of sampes into numsamples
int numsamples = NUMSAMPLES;
// Fill the I and Q buffers with the sample data
for(int index=0; index<numsamples; index++)
{
// Create the I and Q data for the number of waveform
// points and Scale the data (20000 * ...) as a precentage
// of the DAC full scale (-32768 to 32767). This example
// scales to approximately 70% of full scale.
idata[index]=23000 * sin((4*3.14*index)/numsamples);
qdata[index]=23000 * cos((4*3.14*index)/numsamples);
}
// Print the I and Q values to a text file. View the data
// to see if its correct and if needed, plot the data in a
Keysight Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
269

Advertisement

Table of Contents
loading

Table of Contents