Agilent Technologies N5183A MXG Portable Generator User Manual


 
Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide 251
Creating and Downloading Waveform Files
Programming Examples
while(!done)
{
i1 = fgetc(infile); // read the first byte
if(i1==EOF) break;
i2 = fgetc(infile); // read the next byte
if(i2==EOF) break;
ivalue=i1+i2*256; // put the two bytes together
// note that the above format is for a little endian
// processor such as Intel. Reverse the order for
// a big endian processor such as Motorola, HP, or Sun
idata[index++]=ivalue;
if(index==MAXSAMPLES) break;
}
fclose(infile);
// Then read Q values
index = 0;
infile = fopen(qfile, “rb”);
if (infile==NULL) perror (“Error opening file to read”);
while(!done)
{
i1 = fgetc(infile); // read the first byte
if(i1==EOF) break;
i2 = fgetc(infile); // read the next byte
if(i2==EOF) break;
ivalue=i1+i2*256; // put the two bytes together
// note that the above format is for a little endian
// processor such as Intel. Reverse the order for
// a big endian processor such as Motorola, HP, or Sun
qdata[index++]=ivalue;
if(index==MAXSAMPLES) break;
}
fclose(infile);
// Remember the number of samples which were read from the file.
numsamples = index;
// Print the I and Q values to a text file. If you are
// having trouble, look in the file and see if your I and
// Q data looks correct. Plot the data from this file if
// that helps you to diagnose the problem.
FILE *outfile = fopen(ofile, “w”);