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


 
Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-64 Programming Guide
To Measure the Statistics of 50 Measurements
(HP BASIC)
10 ! This program instructs the counter to take 50 period measurements.
20 ! The counter is put into SINGLE measurement mode. The number of
30 ! measurements to take is programmed using ":CALC3:AVER:COUNT 50"
40 ! The counter is told to stop after 50 measurements using
50 ! ":TRIG:COUNT:AUTO ON"
60 ! At the end of 50 measurements, the statistics are calculated and
70 ! sent to the computer.
80 ! ASCII format is used to preserve resolution.
90 ! In this example, the status reporting structure is used to alert
100 ! the program that the statistics are ready.
110 ! The "*OPC" command and the "*ESE 1 " command are used together
120 ! to generate an output from the Event Status Register when
130 ! the measurement is complete. The output of this register is
140 ! used as an input to the Service Request Register. In order for the
150 ! Service Request Register to be able to use that input, the "*SRE 32"
160 ! command must be used. This enables the Service Request Register to
170 ! assert the SRQ line when the measurement is complete.
180 ! Note, that the *OPC command must be sent prior to every measurement
190 ! in order to enable the OPC bit. See Line # 520.
200 INTEGER I,Num_meas
210 DIM Sdev$[22],Mean$[22],Minimum$[22],Maximum$[22]
220 Num_meas=50 ! Statistics based on Num_meas measurements
230 ASSIGN @Count TO 703
240 CLEAR 703 ! Clear the counter and interface
250 OUTPUT @Count;"*RST" ! Reset the counter
260 OUTPUT @Count;"*CLS" ! Clear event registers and error queue
270 OUTPUT @Count;"*SRE 0 " ! Clear service request enable register
280 OUTPUT @Count;"*ESE 0 " ! Clear event status enable register
290 OUTPUT @Count;":STAT:PRES" ! Preset enable registers and transition
300 ! filters for operation and questionable
310 ! status structures.
320 OUTPUT @Count;":FUNC 'PER 1'" ! Measure Period on channel 1.
330 ! Note that the functions must be
340 ! a quoted string. The actual
350 ! string sent to the counter
360 ! is 'PER 1'.
370 OUTPUT @Count;":FREQ:ARM:STAR:SOUR IMM" ! These three lines enable
380 OUTPUT @Count;":FREQ:ARM:STOP:SOUR TIM" ! time arming with a 0.01
390 OUTPUT @Count;":FREQ:ARM:STOP:TIM .01" ! second gate time.
400 OUTPUT @Count;":DISP:TEXT:FEED 'CALC3'" ! Display statistics
410 OUTPUT @Count;":CALC3:AVER:TYPE SDEV" !Display the standard deviation
420 OUTPUT @Count;":CALC3:AVER ON" ! Enable statistics
430 OUTPUT @Count;":CALC3:AVER:COUNT ";Num_meas ! Do statistics on num_meas
440 ! measurements.
450 OUTPUT @Count;":TRIG:COUNT:AUTO ON " !Take Num_meas measurements
460 OUTPUT @Count;"*ESE 1" ! "*ESE 1" is used so bit 5
470 !of the service request register will allow
480 OUTPUT @Count;"*SRE 32" ! an SRQ when measurement complete.
490 ON INTR 7 GOTO Get_averages ! Goto Get_averages on interrupt.
500 ENABLE INTR 7;2 ! Enable interrupt on counter SRQ.
510 PRINT "Waiting for measurement to complete"