EasyManuals Logo
Home>Agilent Technologies>Portable Generator>N5182A

Agilent Technologies N5182A Programming Guide

Agilent Technologies N5182A
366 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
Page #249 background imageLoading...
Page #249 background image
Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide 239
Creating and Downloading Waveform Files
Programming Examples
// 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++)
{
fprintf(outfile, “%d, %d\n”, idata[index], qdata[index]);
}
fclose(outfile);
// Little endian order data, use the character array and for loop.
// If big endian order, comment out this character array and for loop,
// and use the next loop (Big Endian order data).
// We need a buffer to interleave the I and Q data.
// 4 bytes to account for 2 I bytes and 2 Q bytes.
char iqbuffer[NUMSAMPLES*4];
// Interleave I and Q, and swap bytes from little
// endian order to big endian order.
for(index=0; index<numsamples; index++)
{

Table of Contents

Other manuals for Agilent Technologies N5182A

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Agilent Technologies N5182A and is the answer not in the manual?

Agilent Technologies N5182A Specifications

General IconGeneral
BrandAgilent Technologies
ModelN5182A
CategoryPortable Generator
LanguageEnglish

Related product manuals