Using Sub-routines in a measurement program
This program example shows a measurement example using sub-routines in
HP BASIC. The tasks perfumed in this example are:
Initializing the interface and the oscilloscope
Digitizing the acquired signal data
Measuring and printing the frequency and peak-to-peak voltage of the
acquired signal.
10 ! Measurement Example Using Su b-routines
20 !
30 !MAIN PROGRAM
40 !
50 CLEAR SCREEN
60 PRINT "This exam ple program will perform the follo wing tasks:"
70 PRINT " a. initialize the in terface and osci lloscope"
80 PRINT " b. digitize the sign al "
90 PRINT " c. measure and print the frequency "
100 PRINT
110 PRINT "The program assumes the system is configured as:"
120 PRINT " GPIB address = 7"
130 PRINT " Oscilloscop e address = 7"
140 PRINT " Oscilloscope card is in slot 2"
150 PRINT " Signal attach ed to channel 1"
160 PRINT
170 PRINT "If the ad dresses are not co rrect for your con figuration, ch ange"
180 PRINT "the ASS IGN statements in the Initialize function."
190 PRINT
200 PRINT "Press Continue when rea dy to start progra m, or Shift/Brea k to
terminate."
210 PAUSE
220 GOSUB Initialize !initialize interface and oscilloscope
230 GOSUB Get_waveform !digitize signal
240 GOSUB Measur e !measure and prin t frequency
250 STOP
260 !
270 !INITIALIZ E INTERFACE AND OS CILLOSCOPE
280 !
290 Initia lize:
300 ASSIGN @Scope TO 7 07 !Syste m address
310 ASSIGN @Isc TO 7 !GPIB address
Programming Examples
Using Sub-routines in a measurement program
36–33