B&K 4071 user manual Example Arb Program, Program Listing ARB.BAS

Page 67

7.10 Example Arb Program

ARB.BAS

ARB.BAS is a program written in Microsoft Quick Basic, which calculates the points of a sinewave and downloads them to the 4071 as an arbitrary waveform. The program can generate the waveform in all of the supported formats (Floating Point, Integer, Hexadecimal, and Binary) and shows how SYNC Out can be asserted during waveform points.

This program can serve as a good starting point for writing you own waveform generation programs. You can replace the sin(x) function with your own mathematical function and pick which data format you wish to use by calling the appropriate subroutine. (Binary format is the most efficient since it requires the least amount of bytes per data point, and can therefore be downloaded faster).

A complete listing of ARB.BAS begins on the following page. The source file for this program can also be found on the accompanying compact disk.

Program Listing - ARB.BAS

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

'*

BK

Precision Model 4071

*

'*

 

 

*

'*

Arbitrary

Waveform Data Generator Example

*

'*

 

 

*

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

'Program Description

'This program generates a sinewave and downloads the data points to the

'4071 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 4071 ------------

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

INPUT "Is the 4071 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 4071 to enter Arbitrary Waveform Generation Mode -------

'Note: The 4071 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 4071 User’s Manual

'Put the 4071 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

62

BK Precision 4071 User Manual Rev.2.2

Image 67
Contents User’s Manual Page +K Precision Corp Model User’s ManualTable of Contents DC Operation Option Warranty informationRemote operation Arbitrary waveform systemIntroduction Description Modes Feature summarySync out connector Installation and setupSIG Out connector External Modulation In connector External Trigger/Gating/FSK/BPSK input Line in connector External Reference Input / Ext Arb. Clock connectorExternal Arb Sync In / Out connector RS232 Interface connectorRecall / Store key Mode keyOperating controls and keys Field arrow keysNumeric keys 0 to 9, Trigger keyÉ, ê, è, ç keys Clear key One Touch Mode KeysMHz/dBm, KHz/Vp-p/Sec, Hz/mVp-p/mS keys Changing level Operating mode selectionOperating guide Changing frequencyModifying an existing value Changing valuesEntering a new value Basic Sinewave CW Mode Mode descriptionsSinewave Mode 000,000.00 Hz 10.0 dBm Internal AM Mode Input Gain External AM ModeExternal AM Mode Parameters External AM Input gain 000,000.00 Hz PEP level -10.0 dBmPeak Frequency Deviation Internal FM ModeInternal FM Mode Parameters Int FM 1,000 Hz Pk dev 10,000 Hz 000,000.00 Hz 10.0 dBmExternal FM Mode Parameters External FM ModeExternal FM Pk dev 10,000 Hz 000,000.00 Hz 10.0 dBm Int PM 1,000 Hz Pk dev 180 deg 000,000.00 Hz 10.0 dBm Internal PM ModeInternal PM Mode Parameters Peak Phase DeviationExternal PM Mode Parameters External PM ModeExternal PM Pk dev 180 deg 000,000.00 Hz 10.0 dBm Sweep Mode Sweep time Up / Down sweepSpace Frequency Internal FSK ModeInternal FSK Mode Parameters Mark FrequencyExt FSK Input External FSK ModeExternal FSK Mode Parameters Ext FSK Mark 1,000,000.00 Hz Space 2,000,000.00 Hz 10.0 dBmBurst Mode Trig Ton 10,000 mS 000,000.00 Hz Off 10.0 dBm Burst Mode IntroductionBurst frequency Upper/Lower Sideband selections Internal SSB ModeInternal SSB Mode Parameters Int SSB 1,000 Hz Upper Sideband 000,000.00 Hz 10.0 dBmExternal SSB Mode Parameters External SSB ModeExternal SSB Upper Sideband 000,000.00 Hz 10.0 dBm Background Dtmf Generation ModeDtmf generation # Duration 200 mS Delay Level -10.0 dBm Dtmf Generation Mode ParametersDtmf Duration Dtmf DelayDtmf detected digits Dtmf Detection ModeDtmf Detection Mode Parameters Dtmf detection on Ext Mod input 3 # aVoltage Level Power & Voltage Measurement ModePower & Voltage Measurement Mode Parameters Power LevelRemote Mode Arbitrary ModeOther mode Internal Bpsk Mode Parameters Internal Bpsk ModeInt Bpsk 1,000 Hz 000,000.00 Hz 10.0 dBm External Bpsk Mode Parameters External Bpsk ModeExternal Bpsk 000,000.00 Hz 10.0 dBm 10,000 Hz F2 Ton 000 mS Toff 10.0 Dualtone Generation ModeDualtone Examples Baud Rate Data Modulation ModeUsing the Data Modulation Mode Data Modulation Mode ParametersExample Message Downloading Modulation Message DataSaving the Message Triggering the TransmissionEnd Frequency Voltage Controlled Oscillator VCO ModeVCO Mode Parameters Start End 1,000,000.00 Hz 10.0 dBmRemote Operation ConnectingChecking your connection with Hyper Terminal Remote Control Programming Rules Remote Control OperationReturns C Remote Control CommandsReset 4071 to Sine wave mode × ØE1,0 Enable, Disable LCD echo to terminal K1.0 Enable, Disable front panel keys and rotary knobReport hardware and software versions ? or H Print help menu Stp 31,500,000.00 HzLinear Trig Up Time 10,000 mS F0-9 Move cursor to field 0 toExample Remote Control ExamplesQuick Start Guide Arbitrary Waveform ModePin 9-pin cable Pin 25 pin cable adapter Description of the Arbitrary Waveform Generator Introduction to the Arbitrary Waveform SystemPulse Generator Switching ModesFeature Summary Function GeneratorContinuous/Triggered mode Arbitrary Waveform ModeInt Clock / Ext Clock / Lock Master Lock slave mode PhaseRepetition Frequency Function Generator ModeFunction Gen Wave Pos Ramp Rep Freq 100,000 Hz 000 mV WaveformPositive Only Pulse Generator ModeDuty Cycle Cwaveload /COMx /y /baudz filename.ext Using WAVELOAD.EXEDownloading arbitrary waveforms Saving Arbitrary WaveformsUsing your own program Floating Point Format Data FormatsRules for Floating Point format Example #2 Time & Value Floating Point FormatDigital Format Rules for Integer format Integer FormatRules for Hexadecimal format Hexadecimal FormatExample The data value E468 is handled as follows Rules for Binary format Binary FormatExample Arb Multiple Units LockingGenerator Waveform Size Restrictions More on Phase OffsetsPhase Resolution Starting Address = Number of waveform points * Phase OffsetProgram Listing ARB.BAS Example Arb ProgramClose System Subroutines Return Print #1, a Send integer value to Return Return DC Operation Option Wiring DiagramOperating Modes 4071 SpecificationsRemote Software CDAppendix a Hardware SetupCLS CLS Print Print Subroutines END SUB Appendix B Television Remote Control ExampleCLS Make sure a 4071 is attached to the serial port Print Limited Two-Year Warranty Service Information Savi Ranch Pkwy Yorba Linda, CA 92887 USA TEL