Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide 257
Creating and Downloading Waveform Files
Programming Examples
maxAmp = Qwave[i];
else if( minAmp > Qwave[i] )
minAmp = Qwave[i];
}
maxAmp = fabs(maxAmp);
minAmp = fabs(minAmp);
if( minAmp > maxAmp )
maxAmp = minAmp;
// Convert to short integers and interleave I/Q data
scale = 32767 / maxAmp; // Watch out for divide by zero.
for( i=0; i<points; i++)
{
waveform[2*i] = (short)floor(Iwave[i]*scale + 0.5);
waveform[2*i+1] = (short)floor(Qwave[i]*scale + 0.5);
}
// If on a PC swap the bytes to Big Endian
if( strcmp(computer,”PCWIN”) == 0 )
//if( PC )
{
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;
}
}
// Save the data to a file
// Use FTP or one of the download assistants to download the file
to the
// signal generator
char *filename = “C:\\Temp\\PSGTestFile”;
Summary of Contents for X-Series
Page 4: ...4 ...
Page 10: ...10 Contents ...