
Downloading an Arbitrary Waveform over RS-232
This program teaches the following concepts:
How to define a set of binary waveform points and download the
points to volatile memory. The downloaded waveform is a damped
sine wave.
How to copy the download waveform to non-volatile memory.
BASIC / RS-232 (Program 5)
10 !
20 ! This program shows how to download an arbitrary waveform
30 ! using binary data over the RS-232 interface. The program
40 ! generates a damped sine wave using 16,000 points.
50 !
60 OPTION BASE 1
70 CONTROL 10,3;9600 ! Configure PC for 9600 baud (COM2)
80 CONTROL 10,4;7 ! Configure PC for 8 bits with no parity
90 INTEGER Waveform(16000),I,Ncycles ! Dimension array and variables
100 REAL Damp_factor ! Define real variable
110 ASSIGN @Fgen TO 10 ! Device address is 10
120 ASSIGN @Bin TO 10;FORMAT OFF ! Prepare interface for binary data
130 OUTPUT @Fgen;"*RST" ! Reset the function generator
140 !
150 OUTPUT @Fgen;"SYST:REM" ! Enable the remote RS-232 mode
160 OUTPUT @Fgen;"FORM:BORD SWAP" ! Swap data bytes (send LSB first)
170 OUTPUT @Fgen;"FREQ 5000" ! Output frequency is 5 kHz
180 OUTPUT @Fgen;"OUTP:LOAD 50" ! Output termination is 50 ohms
190 OUTPUT @Fgen;"VOLT 5" ! Output amplitude is 5 Vpp
200 !
210 Ncycles = 10 ! Define number of cycles
220 Damp_factor = -5 ! Define damping factor
230 !
240 ! Calculate data points
250 !
260 DISP "Calculating Data Points..."
270 FOR I=1 TO 16000
280 IF I<14000 THEN
290 Waveform(I)=SIN(2*PI*Ncycles*I/14000)*2047
300 Waveform(I)=Waveform(I)*EXP(Damp_factor*I/14000)
310 ELSE
320 Waveform(I)=0
330 END IF
340 NEXT I
6
Chapter 6 Application Programs
Downloading an Arbitrary Waveform over RS-232
267
Summary of Contents for 33120A
Page 2: ......
Page 10: ...8 ...
Page 14: ...Contents Contents 12 ...
Page 15: ...1 Quick Start 1 ...
Page 31: ...2 Front Panel Menu Operation 2 ...
Page 55: ...3 Features and Functions 3 ...
Page 126: ...124 ...
Page 127: ...4 Remote Interface Reference 4 ...
Page 204: ...SCPI Status System Chapter 4 Remote Interface Reference The SCPI Status Registers 202 ...
Page 228: ...226 ...
Page 229: ...5 Error Messages 5 ...
Page 244: ...242 ...
Page 245: ...6 Application Programs 6 ...
Page 272: ...270 ...
Page 273: ...7 Tutorial 7 ...
Page 299: ...8 Specifications 8 ...
Page 304: ...302 ...