Keysight E4428C ESG RF Programming Manual page 274

Signal generators
Table of Contents

Advertisement

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 ),
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];
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;
}
266
// Character pointer to short int data
points*2, stream );
Keysight Signal Generators Programming Guide

Advertisement

Table of Contents
loading

Table of Contents