258 Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
FILE *stream = NULL;
stream = fopen(filename, “w+b”);// Open the file
if (stream==NULL) perror (“Cannot Open File”);
int numwritten = fwrite( (void *)waveform, sizeof( short ),
points*2, stream );
fclose(stream);// Close the file
// 3.) Load the internal Arb format file *********************
// This process is just the reverse of saving the waveform
// Read in waveform as unsigned short integers.
// Swap the bytes as necessary
// Normalize b-1
// De-interleave the I/Q Data
// Open the file and load the internal format data
stream = fopen(filename, “r+b”);// Open the file
if (stream==NULL) perror (“Cannot Open File”);
int numread = fread( (void *)waveform, sizeof( short ),
points*2, stream );
fclose(stream);// Close the file
// If on a PC swap the bytes back to Little Endian
if( strcmp(computer,”PCWIN”) == 0 )
{
pChar = (char *)&waveform[0]; // Character pointer to short
int data
for( i=0; i<2*points; i++ )
{
buf = *pChar;
*pChar = *(pChar+1);
*(pChar+1) = buf;
pChar+= 2;
}
}
// Normalize De-Interleave the IQ data
double IwaveIn[POINTS];
double QwaveIn[POINTS];
Summary of Contents for X-Series
Page 4: ...4 ...
Page 10: ...10 Contents ...