Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide 263
Creating and Downloading Waveform Files
Programming Examples
{
// Create a text file to view the waveform
// prior to downloading it to the signal generator.
// This verifies that the data looks correct.
char *ofile = “c:\\temp\\iq.txt”;
// Create arrays to hold the I and Q data
int idata[NUMSAMPLES];
int qdata[NUMSAMPLES];
// save the number of sampes into numsamples
int numsamples = NUMSAMPLES;
// Fill the I and Q buffers with the sample data
for(int index=0; index<numsamples; index++)
{
// Create the I and Q data for the number of waveform
// points and Scale the data (20000 * ...) as a precentage
// of the DAC full scale (-32768 to 32767). This example
// scales to approximately 70% of full scale.
idata[index]=23000 * sin((4*3.14*index)/numsamples);
qdata[index]=23000 * cos((4*3.14*index)/numsamples);
}
// Print the I and Q values to a text file. View the data
// to see if its correct and if needed, plot the data in a
// spreadsheet to help spot any problems.
FILE *outfile = fopen(ofile, “w”);
if (outfile==NULL) perror (“Error opening file to write”);
for(index=0; index<numsamples; index++)
{
Summary of Contents for X-Series
Page 4: ...4 ...
Page 10: ...10 Contents ...