Creating and Downloading Waveform Files
Programming Examples
while(!done)
{
i1 = fgetc(infile);
if(i1==EOF) break;
i2 = fgetc(infile);
if(i2==EOF) break;
ivalue=i1+i2*256;
// note that the above format is for a little endian
// processor such as Intel.
// 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);
if(i1==EOF) break;
i2 = fgetc(infile);
if(i2==EOF) break;
ivalue=i1+i2*256;
// note that the above format is for a little endian
// processor such as Intel.
// 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.
// having trouble, look in the file and see if your I and
// Q data looks correct.
// that helps you to diagnose the problem.
FILE *outfile = fopen(ofile, "w");
280
// read the first byte
// read the next byte
// put the two bytes together
Reverse the order for
// read the first byte
// read the next byte
// put the two bytes together
Reverse the order for
If you are
Plot the data from this file if
Keysight Signal Generators Programming Guide