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


 
Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-86 Programming Guide
To Optimize Throughput (QuickBASIC)
'This program sets up the counter make 1000 frequency as fast as possible.
'Note that the arming is set to AUTO. This allows measurements to be taken
'quickly, but at the least resolution the counter can provide.
'See the program comments for details.
'Requires an HP 82335A/B HPIB interface card to a PC.
'The data is sent in ASCII format to preserve resolution.
'
'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 i AS INTEGER 'i is used for loops
DIM samples AS INTEGER
samples = 1000 'Number of measurements
DIM freqstring(1000) AS STRING * 23 'String to be read
'Reading ASCII formatted data
'gives results to the correct
'resolution. Must be read into
'a string. Also, provides the
'fastest data transfer.
maxelem% = 22 'Maximum number of characters expected
actual% = 0 'Returns actual characters received
source& = 703 'Counter at address 3
isc& = 7 'Select code 7
state% = 1 'Used in IOEOI
CLS 0
CALL IOEOI(isc&, state%) 'Make sure EOI enabled
CALL IOCLEAR(source&) 'Clear the 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 register
CALL sendhp(":STAT:PRES") 'Preset enable registers and transition
'filters for operation and questionable
'status structures
'The following commands will provide the fastest measurement throughput,
'independent of the state of the counter prior to these commands.
CALL sendhp(":FORMAT ASCII") 'ASCII give fastest throughput
CALL sendhp(":FUNC " + CHR$(34) + "FREQ 1" + CHR$(34)) 'Measure frequency
'The function must be a quoted string. The actual string sent to the
'counter is "FREQ 1"