Agilent Technologies N5183A MXG User Manual

Page 243

Advertising
background image

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

233

Creating and Downloading Waveform Files

Programming Examples

// 1.) Create Simple IQ Signal *****************************************

// This signal is a single tone on the upper

// side of the carrier and is usually refered to as

// a Single Side Band Suppressed Carrier (SSBSC) signal.

// It is nothing more than a cosine wavefomm in I

// and a sine waveform in Q.

int points = POINTS; // Number of points in the waveform

int cycles = 101; // Determines the frequency offset from the carrier

double Iwave[POINTS]; // I waveform

double Qwave[POINTS]; // Q waveform

short int waveform[2*POINTS]; // Holds interleaved I/Q data

double maxAmp = 0; // Used to Normalize waveform data

double minAmp = 0; // Used to Normalize waveform data

double scale = 1;

char buf; // Used for byte swapping

char *pChar; // Used for byte swapping

bool PC = true; // Set flag as appropriate

double phaseInc = 2.0 * 3.141592654 * cycles / points;

double phase = 0;

int i = 0;

for( i=0; i<points; i++ )

{

phase = i * phaseInc;

Iwave[i] = cos(phase);

Qwave[i] = sin(phase);

}

// 2.) Save waveform in internal format *********************************

// Convert the I and Q data into the internal arb format

// The internal arb format is a single waveform containing interleaved IQ

// data. The I/Q data is signed short integers (16 bits).

// The data has values scaled between +-32767 where

// DAC Value Description

// 32767 Maximum positive value of the DAC

// 0 Zero out of the DAC

// -32767 Maximum negative value of the DAC

// The internal arb expects the data bytes to be in Big Endian format.

// This is opposite of how short integers are saved on a PC (Little Endian).

// For this reason the data bytes are swapped before being saved.

Advertising
This manual is related to the following products: