EasyManua.ls Logo

Keysight E4428C ESG RF - Page 274

Keysight E4428C ESG RF
404 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
266 Keysight Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
// 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”;
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 between +-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];
for( i=0; i<points; i++)
{
IwaveIn[i] = waveform[2*i] / 32767.0;
QwaveIn[i] = waveform[2*i+1] / 32767.0;
}
return 0;
}

Table of Contents

Related product manuals