278 Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
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”);
if (outfile==NULL) perror (“Error opening file to write”);
for(index=0; index<numsamples; index++)
{
fprintf(outfile, “%d, %d\n”, idata[index], qdata[index]);
}
fclose(outfile);
// The E443xB, E4438C, E8267C or E8267D all use big-endian
// processors. If your software is running on a little-endian
Содержание X-Series
Страница 4: ...4 ...
Страница 10: ...10 Contents ...