. . . continued
350 !
360 ! Download data points to volatile memory
370 !
380 DISP "Downloading Arb..."
390 OUTPUT @Fgen;"DATA:DAC VOLATILE,#532000"; ! Output binary block header
400 WAIT 1 ! Wait for interface
410 OUTPUT @Bin;Waveform(*); ! Output binary block
420 WAIT 1 ! Wait for interface
430 OUTPUT @Fgen;";*OPC?" ! Send terminator and wait for download to complete
440 ENTER @Fgen;Value ! Enter value
450 DISP "Download Complete"
460 !
470 OUTPUT @Fgen;"DATA:COPY DAMP_SINE, VOLATILE" ! Copy to non-volatile memory
480 OUTPUT @Fgen;"FUNC:USER DAMP_SINE" ! Select the active waveform
490 OUTPUT @Fgen;"FUNC:SHAP USER" ! Output the selected waveform
500 END
QuickBASIC / RS-232 (Program 5)
’ This program shows how to download an arbitrary waveform
’ using ASCII data over the RS-232 interface. The program
’ generates a damped sine wave using 1,000 points.
’
npnts = 1000 ’ Define number of ASCII points in waveform
NCYCLES = 10 ’ Define number of cycles
DAMPFACTOR = -5 ’ Define damping factor
DIM waveform(npnts) ’ Dimension waveform array
’
’ Configure COM2 for 9600 baud, even parity, 7 data bits, 2 stop bits,
’ suppress detection of Request to Send (rs), set timeout of Data Carrier
’ Detect line (cd), and terminate output with line feed (lf).
’
OPEN "com2:9600,e,7,2,rs,cd,lf,pe" FOR RANDOM AS #1 LEN = 1000
’
PRINT #1, ":SYST:REM" ’ Enable the remote RS-232 mode
’
PRINT #1, "*RST" ’ Reset the function generator
PRINT #1, "FORM:BORD SWAP" ’ Swap data bytes (send LSB first)
PRINT #1, "FREQ 5000" ’ Output frequency is 5 kHz
PRINT #1, "OUTP:LOAD 50" ’ Output termination is 50 ohms
PRINT #1, "VOLT 5" ’ Output amplitude is 5 Vpp
Chapter 6 Application Programs
Downloading an Arbitrary Waveform over RS-232
268