beautypg.com

Agilent Technologies N5183A MXG User Manual

Page 247

background image

Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide

237

Creating and Downloading Waveform Files

Programming Examples

for (int i=0; i

{

iqData[2*i] = AMPLITUDE * sin(two_pi*i/(float)SAMPLES);

iqData[2*i+1] = AMPLITUDE * cos(two_pi*i/(float)SAMPLES);

}

// make sure bytes are in the order MSB(most significant byte) first. (PC only).

char* cptr = (char*)iqData;// cast the integer values to characters

for (int i=0; i<(4*SAMPLES); i+=2)// 4*SAMPLES

{

char temp = cptr[i];// swap LSB and MSB bytes

cptr[i]=cptr[i+1];

cptr[i+1]=temp;

}

// now write the buffer to a file

out_stream.write((char*)iqData, 4*SAMPLES);

return 0;

}

This manual is related to the following products: