264 Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
fprintf(outfile, “%d, %d\n”, idata[index], qdata[index]);
}
fclose(outfile);
// Little endian order data, use the character array and for
loop.
// If big endian order, comment out this character array and for
loop,
// and use the next loop (Big Endian order data).
// We need a buffer to interleave the I and Q data.
// 4 bytes to account for 2 I bytes and 2 Q bytes.
char iqbuffer[NUMSAMPLES*4];
// Interleave I and Q, and swap bytes from little
// endian order to big endian order.
for(index=0; index<numsamples; index++)
{
int ivalue = idata[index];
int qvalue = qdata[index];
iqbuffer[index*4] = (ivalue >> 8) & 0xFF; // high byte of i
iqbuffer[index*4+1] = ivalue & 0xFF; // low byte of i
iqbuffer[index*4+2] = (qvalue >> 8) & 0xFF; // high byte of q
iqbuffer[index*4+3] = qvalue & 0xFF; // low byte of q
}
// Big Endian order data, uncomment the following lines of code.
// Interleave the I and Q data.
// short iqbuffer[NUMSAMPLES*2]; // Big endian order,
uncomment this line
// for(index=0; index<numsamples; index++) // Big endian order,
uncomment this line
// { // Big endian order,
uncomment this line
Содержание X-Series
Страница 4: ...4 ...
Страница 10: ...10 Contents ...