Program listing - arb.bas – BNC 630 User Manual

Page 74

Advertising
background image

69

Program Listing - ARB.BAS

'******************************************************************************
'* BNC Model 630 *
'* *
'* Arbitrary Waveform Data Generator Example *
'* *
'******************************************************************************

' Program Description

' This program generates a sinewave and downloads the data points to the
' 630 for generation with the Arbitrary Waveform Generator.

' It can generate the data in a variety of different number formats.
' Each format has its own subroutine below.

' ------- Open the serial port for communication with the 630 ------------

' Ask the user which serial port is attached to the 630

INPUT "Is the 630 on Com port 1 or 2? (1/2) >"; a$

' Open Com port, Disable CD,CTS,DCD, give 5 sec max. to open,
' Set Rx buffer to 2K, Disable RTS, set Tx buff to 1K, Random = i/o,
' Set random access buffer size to 2K

IF a$ = "1" THEN
OPEN "COM1:9600,n,8,1,CD0,CS0,DS0,OP5000,RB2048,RS,TB1024" FOR RANDOM AS #1 LEN = 2048
GOTO EndPortSel
END IF

IF a$ = "2" THEN
OPEN "COM2:9600,n,8,1,CD0,CS0,DS0,OP5000,RB2048,RS,TB1024" FOR RANDOM AS #1 LEN = 2048
GOTO EndPortSel
END IF

GOTO ArbExit ' Abort program if neither Com1 nor Com2 was selected

EndPortSel:

' ---- Command the 630 to enter Arbitrary Waveform Generation Mode -------
' Note: The 630 does not need to be in Arbitrary Waveform generation mode
' to accept data points over the serial port. We switch to Arbitrary
' waveform mode here as an example of remotely controlling the operation
' of the unit, and to have the waveform generated after the download.
' For more information on Remote Control, See the 630 User’s Manual

' Put the 630 in Arbitrary Waveform mode, set parameters

PRINT #1, "G F11 F240Z F35Y"

' G = Set Arbitrary Mode

' F11 = Set Continuous (not Triggered) mode

' F240Z = Set sampling clock to 40 MHz

' F35Y = Set output level to 5V p-p

Advertising