Agilent Technologies N5183A MXG User Manual
Page 262
252
Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
if (outfile==NULL) perror (“Error opening file to write”);
for(index=0; 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 // processor such as Intel, then you will need to swap the // bytes in the data before sending it to the signal generator. // The arrays ibuffer and qbuffer are used to hold the data // after any byte swapping, shifting or scaling. // In this example, we’ll assume that the data is in the format // of the E443xB without markers. In other words, the data // is in the range 0-16383. // 0 gives negative full-scale output // 8192 gives 0 V output // 16383 gives positive full-scale output // If this is not the scaling of your data, then you will need // to scale your data appropriately in the next two blocks. // ibuffer and qbuffer will hold the data in the E443xB format. // No scaling is needed, however we need to swap the byte order // on a little endian computer. Remove the byte swapping // if you are using a big endian computer. for(index=0; index { int ivalue = idata[index]; int qvalue = qdata[index]; ibuffer[index*2] = (ivalue >> 8) & 0xFF; // high byte of i ibuffer[index*2+1] = ivalue & 0xFF; // low byte of i qbuffer[index*2] = (qvalue >> 8) & 0xFF; // high byte of q qbuffer[index*2+1] = qvalue & 0xFF; // low byte of q } // iqbuffer will hold the data in the E4438C, E8267C, E8267D // format. In this format, the I and Q data is interleaved. // The data is in the range -32768 to 32767. // -32768 gives negative full-scale output