Keysight E4428C ESG RF Programming Manual page 273

Signal generators
Table of Contents

Advertisement

// For this reason the data bytes are swapped before being saved.
// Find the Maximum amplitude in I and Q to normalize the data between +-1
maxAmp = Iwave[0];
minAmp = Iwave[0];
for( i=0; i<points; i++)
{
if( maxAmp < Iwave[i] )
maxAmp = Iwave[i];
else if( minAmp > Iwave[i] )
minAmp = Iwave[i];
if( maxAmp < Qwave[i] )
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;
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];
for( i=0; i<2*points; i++ )
{
buf = *pChar;
*pChar = *(pChar+1);
*(pChar+1) = buf;
pChar+= 2;
}
}
Keysight Signal Generators Programming Guide
// Watch out for divide by zero.
// Character pointer to short int data
Creating and Downloading Waveform Files
Programming Examples
265

Advertisement

Table of Contents
loading

Table of Contents