Visual basic programming examples – Agilent Technologies N5183A MXG User Manual

Page 272

Advertising
background image

262

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

Creating and Downloading Waveform Files
Programming Examples

Visual Basic Programming Examples

Creating I/Q Data—Little Endian Order

On the documentation CD, this programming example’s name is “Create_IQData_vb.txt.”

This Visual Basic programming example, using Microsoft Visual Basic 6.0, uses little endian order
data, and performs the following functions:

error checking

I an Q integer array creation

I an Q data interleaving

byte swapping to convert to big endian order

binary data file storing to a PC or workstation

Once the file is created, you can download the file to the signal generator using FTP (see

“FTP

Procedures” on page 210

).

'*************************************************************************************

' Program Name: Create_IQData

' Program Description: This program creates a sine and cosine wave using 200 I/Q data

' samples. Each I and Q value is represented by a 2 byte integer. The sample points are

' calculated, scaled using the AMPLITUDE constant of 32767, and then stored in an array

' named iq_data. The AMPLITUDE scaling allows for full range I/Q modulator DAC values.

' Data must be in 2's complemant, MSB/LSB big-endian format. If your PC uses LSB/MSB

' format, then the integer bytes must be swapped. This program converts the integer

' array values to hex data types and then swaps the byte positions before saving the

' data to the IQ_DataVB file.

'**************************************************************************************

Private Sub Create_IQData()

Dim index As Integer

Dim AMPLITUDE As Integer

Dim pi As Double

Dim loByte As Byte

Dim hiByte As Byte

Dim loHex As String

Dim hiHex As String

Dim strSrc As String

Dim numPoints As Integer

Dim FileHandle As Integer

Dim data As Byte

Dim iq_data() As Byte

Dim strFilename As String

strFilename = "C:\IQ_DataVB"

Const SAMPLES = 200 ' Number of sample PAIRS of I and Q integers for the waveform

Advertising
This manual is related to the following products: