Agilent Technologies E8663B Portable Generator User Manual


 
250 Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
// This is a text file to which we will write the
// I and Q data just for debugging purposes. It is
// a good programming practice to check your data
// in this way before attempting to write it to
// the instrument.
char *ofile = “c:\\SignalGenerator\\data\\iq.txt”;
// Create arrays to hold the I and Q data
int idata[MAXSAMPLES];
int qdata[MAXSAMPLES];
// Often we must modify, scale, or offset the data
// before loading it into the instrument. These
// buffers are used for that purpose. Since each
// sample is 16 bits, and a character only holds
// 8 bits, we must make these arrays twice as long
// as the I and Q data arrays.
char ibuffer[MAXSAMPLES*2];
char qbuffer[MAXSAMPLES*2];
// For the E4438C or E8267C/67D, we might also need to interleave
// the I and Q data. This buffer is used for that
// purpose. In this case, this buffer must hold
// both I and Q data so it needs to be four times
// as big as the data arrays.
char iqbuffer[MAXSAMPLES*4];
// Declare variables which will be used later
bool done;
FILE *infile;
int index, numsamples, i1, i2, ivalue;
// In this example, we’ll assume the data files have
// the I and Q data in binary form as unsigned 16 bit integers.
// This next block reads those binary files. If your
// data is in some other format, then replace this block
// with appropriate code for reading your format.
// First read I values
done = false;
index = 0;
infile = fopen(ifile, “rb”);
if (infile==NULL) perror (“Error opening file to read”);