Instruction manual

Chapter 3 Programming Your Counter for Remote Operation
Programming Examples
3-56 Programming Guide
3
Making a Frequency Measurement (BASIC)
10 ! This program sets up the instrument to make 10 frequency
20 ! measurements on channel 2.
30 ! The results are displayed on the computer CRT.
40 ! ASCII format is used to preserve resolution.
50 !
60 INTEGER I ! Declare variables
70 DIM Freq$(10)[22] ! Declare string to enter data
80 ! Using strings to enter ASCII format
90 ! data yields results formatted to the
100 ! correct resolution. ASCII is the
110 ! default format for the instrument.
120 Samples=10 ! Take 10 measurements
130 !
140 ASSIGN @Count TO 703 ! Assign I/O path for instrument
150 CLEAR 703 ! Clear the instrument and interface
160 OUTPUT @Count;"*RST" ! Reset the instrument
170 OUTPUT @Count;"*CLS" ! Clear event registers and error queue
180 OUTPUT @Count;"*SRE 0" ! Clear service request enable register
190 OUTPUT @Count;"*ESE 0" ! Clear event status enable register
200 OUTPUT @Count;":STAT:PRES" ! Preset enable registers and 210
210 ! transition filters for operation and
220 ! questionable status structures.
230 OUTPUT @Count;":CONF:FREQ DEFAULT,DEFAULT, (@2)"
240 ! Measure frequency on channel 2
270 !
280 CLEAR SCREEN ! Clear the computer display
290 FOR I=1 TO Samples ! Start making measurements
300 OUTPUT @Count;"INIT:IMM" ! Trigger new measurement
310 OUTPUT @Count;"READ?" ! Process measurement
320 ENTER @Count;Freq$(I) ! fetch the data
330 PRINT USING "11A,DD,4A,22A,3A";"Frequency (";I;") = ";Freq$(I);" Hz"
340 NEXT I
350 LOCAL 703 ! Return instrument to local
360 END