DECLARE SUB sendhp (code$) REM $INCLUDE: 'QBSETUP.BAS' DIM SHARED source AS LONG DIM i AS INTEGER
DIM samples AS INTEGER samples = 1000
DIM freqstring(1000) AS STRING * 23
maxelem% = 22 actual% = 0 source& = 703 isc& = 7 state% = 1
CLS 0
CALL IOEOI(isc&, state%) CALL IOCLEAR(source&) CALL sendhp("*RST") CALL sendhp("*CLS") CALL sendhp("*SRE 0") CALL sendhp("*ESE 0") CALL sendhp(":STAT:PRES")

Chapter 3 Programming Your Universal Counter for Remote Operation

Programming Examples

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

'Required by HP 82335A 'Address and select code 'i is used for loops

'Number of measurements '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.

'Maximum number of characters expected 'Returns actual characters received 'Counter at address 3

'Select code 7 'Used in IOEOI

'Make sure EOI enabled

'Clear the counter and interface 'Reset counter

'Clear event registers and error queue 'Clear service request enable register 'Clear event status enable register '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"

3-86

Programming Guide