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


 
Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-82 Programming Guide
To Use Limits to Filter Data Before Measuring Stats
(QuickBASIC)
'This program sets up the counter to determine the statistics of
'50 period measurements that are within limits defined by the variables
''UPPER' and 'LOWER'. Periods that are outside of the limits are not
'included in the statistics. The Limit graph is displayed so you can see if
'measurements are in limit.
'To alert the program that the statistics are ready, bit 8 in the Operation
'Status register is used. When statistics are being calculated, this bit
'is high, when they are complete, the bit goes low. By using the transition
'filters, an SRQ can be generated when statistics are complete.
'The SUB sendhp sends commands to the counter
DECLARE SUB sendhp (code$)
REM $INCLUDE: 'QBSETUP.BAS' 'Required by HP 82335A
DIM SHARED source AS LONG 'Address and select code
DIM status AS INTEGER 'Status byte variable
DIM complete AS INTEGER 'Variable used in the program
DIM statusbyte AS INTEGER 'Status Byte variable
DIM maximum AS STRING * 23 'Strings used to enter stats
DIM minimum AS STRING * 23
DIM mean AS STRING * 23
DIM sdev AS STRING * 23
DIM nummeas AS INTEGER 'Number of measurements
DIM lower AS SINGLE 'Lower limit
DIM upper AS SINGLE 'Upper limit
nummeas = 50 'Number of statistics measurements
lower = .0000005 'Limit values
upper = .000001
actual% = 0 'Used in IOENTERS
maxelem% = 23 'Used in IOENTERS
source& = 703 'Counter at address 3
isc& = 7 'Select code 7
complete = 0 'Used to check if stats received
state% = 1 'Used in IOEOI
priority% = 1 'Used in IOPEN
CLS
CALL IOEOI(isc&, state%) 'Make sure EOI enabled
CALL IOCLEAR(source&) 'Reset counter and interface
CALL sendhp("*RST") 'Reset counter
CALL sendhp("*CLS") 'Clear event registers and error queue
CALL sendhp("*SRE 0") 'Clear service request enable register
CALL sendhp("*ESE 0") 'Clear event status enable registers
CALL sendhp(":STAT:PRES") 'Preset filters for Operation and
'Questionable Status structures
CALL sendhp(":FUNC " + CHR$(34) + "PER 1" + CHR$(34)) 'Measure period
'The function must be a quoted string. The actual string sent to the
'counter is "PER 1"