HP (Hewlett-Packard) HP 53131A Water Dispenser User Manual


 
Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-60 Programming Guide
Easiest Way to Make a Measurement (HP BASIC)
10 ! This program shows how to use the MEASure group of instructions to
20 ! quickly and easily make any of the counter's measurements.
30 ! In this program, time interval, frequency and period will be measured.
40 ! However, the MEASure group can make measurements using any of the other
50 ! counter functions.
60 ! The program is composed of three subroutines. The first uses only
70 ! the MEAS:TINT? (@1),(@2) command to make a time interval measurement.
80 ! The second subroutine uses CONF:FREQ and READ? to make a measurement.
90 ! The third uses CONF:FREQ, INIT and FETCH? to make a measurement.
100! The comments at the start of each subroutine explain the benefits of
110! each method.
120 INTEGER I ! Declare variables
130 DIM Freq$[22] ! Declare string to enter data
140 DIM Period$[22] ! Using strings to enter ASCII format
150 DIM Tint$[22] ! data yields results formatted to the
160 ! correct resolution. ASCII is the
170 ! default format for the counter.
180 ! The following commands reset the counter
190 ASSIGN @Count TO 703 ! Assign I/O path for counter
200 CLEAR 703 ! Clear the counter and interface
210 OUTPUT @Count;"*RST" ! Reset the counter
220 OUTPUT @Count;"*CLS" ! Clear event registers and error queue
230 OUTPUT @Count;"*SRE 0" ! Clear service request enable register
240 OUTPUT @Count;"*ESE 0" ! Clear event status enable register
250 OUTPUT @Count;":STAT:PRES" ! Preset enable registers and
260 ! transition filters for operation and
270 ! questionable status structures.
280 GOSUB Measure ! Call subroutines to make measurements
290 LINPUT "Press RETURN for CONF and READ",A$
300 GOSUB Conf_read
310 LINPUT "Press RETURN for CONF, INIT and FETC",A$
320 GOSUB Init_fetc
330 STOP
340 !
350 !
360 Measure:! Use the MEAS:TINT? (@1),(@2) command
370 ! The MEAS:TINT? (@1),(@2) query initiates a complete measurement
380 ! sequence. It configures the counter for a 2 channel time interval
390 ! measurement, starts the measurement and asks for the data. The MEAS
400 ! command is the simplest (and least flexible) way to make a measurement
410 ! and collect data.
420 ! Make sure there are signals at both counter inputs.
430 PRINT "Time Interval from 1 to 2 measured using MEAS:TINT? (@1),(@2)"
440 OUTPUT @Count;"MEAS:TINT? (@1),(@2)" ! Configure for time interval
450 ! and query counter for results.
460 ENTER @Count;Tint$
470 PRINT
480 PRINT "Time Interval 1 to 2 = ";Tint$
490 PRINT
500 RETURN
510 !
520 !
530 Conf_read:! Use CONF and READ? command