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


 
Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-66 Programming Guide
To Use Limits to Filter Data Before Measuring Stats (HP
BASIC)
10 ! This program instructs the counter to determine the statistics of
20 ! 50 Period measurements that are within the limits defined by the
30 ! variables "Upper" and "Lower". Periods that are outside of
40 ! the limits are not included in the statistics. The Limit graph is
50 ! displayed so you can see if measurements are in limit.
60 ! To alert the program that the statistics are ready, bit 8 in the
70 ! Operation Status register is used. When statistics are being
80 ! calculated, this bit is high, when they are complete, the bit goes
90 ! low. By using the transition filters, an SRQ can be generated when
100 ! statistics are complete.
110 ! ASCII format is used to preserve resolution.
120 !
130 INTEGER I,Num_meas
140 DIM Sdev$[22],Mean$[22],Minimum$[22],Maximum$[22]
150 Num_meas=50 ! Statistics based on num_meas measurements
160 Upper=1.10E-7 ! Upper period to be included in statistics
170 Lower=1.00E-7 ! Lower period to be included in statistics
180 CLEAR SCREEN
190 ASSIGN @Count TO 703
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 transition
260 ! filters for operation and questionable
270 ! status structures.
280 OUTPUT @Count;":FUNC 'PER'" ! Measure frequency on channel 1
290 ! Note that the function must be
300 ! a quoted string. The actual
310 ! string sent to the counter
320 ! is "PER".
330 OUTPUT @Count;":FREQ:ARM:STAR:SOUR IMM" ! These three lines enable
340 OUTPUT @Count;":FREQ:ARM:STOP:SOUR TIM" ! time arming with a 0.01
350 OUTPUT @Count;":FREQ:ARM:STOP:TIM .01" ! second gate time.
360 OUTPUT @Count;":STAT:OPER:ENABLE 256" ! Computing Statistics bit in
370 ! Operation status register
380 OUTPUT @Count;":STAT:OPER:NTR 256" ! When statistics are complete,
390 OUTPUT @Count;":STAT:OPER:PTR 0" ! the bit will go from high to low
400 ! so a negative transition is
410 ! needed to enable the bit that
420 ! is summarized in the Status Byte
430 ! Register.
440 OUTPUT @Count;"*SRE 128" ! This is the bit from the
450 ! Operation Status register that is
460 ! summarized in the Status Byte
470 ! Register.
480 ! When it goes high, SRQ will be
490 ! asserted.