Chapter 3 Programming Your Counter for Remote Operation
Programming Examples
Programming Guide
3-57
3
Making a Frequency Measurement (QuickBASIC)
‘This program configures the counter to make 10 frequency measurements
‘on channel 2.
‘The results are printed on the computer monitor.
‘Data is sent in ASCII format to preseve 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 = 10
‘Number of measurements
DIM freqs(10) AS STRING * 23
‘String to be read
‘Reading ASCII formatted data
‘gives results to the correct
‘resolution. Must be read into
‘a string. The maximum number
‘of characters that can ever be
‘sent is 20 per measurement.
source& = 703
‘Counter at address 3
isc&p; = 7
‘Select code 7
state% = 1
‘Used in IOEOI
CLS
‘Clear screen
CALL IOEOI(isc&p;, state%)
‘Make sure EOI enabled
CALL IOCLEAR(source&)
‘Clear the counter and interface
CALL sendhp(“*RST”)
‘Reset counter and stop autotriggering
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
CALL sendhp(“:func “ + CHR$(34) + “FREQ 2” + CHR$(34)) ‘Measure frequency
CLS
‘Clear computer screen
FOR i = 1 TO samples
CALL sendhp(“INIT;*WAI;:DATA?”)
‘Initiate a measurement and
‘get the result
CALL IOENTERS(source&ng, freqs(i), 23, actf%) ‘Read the ASCII characters
PRINT “Frequency”; i; “= “; freqs(i)
NEXT i
END
‘ Subroutine to send command to HP 5315xA/
SUB sendhp (code$)
CALL iooutputs(source, code$, LEN(code$))
END SUB
Summary of Contents for 53150A Series
Page 1: ... Programming Guide HP 53150A 151A 152A Microwave Frequency Counter ...
Page 2: ......
Page 10: ...Contents x Programming Guide ...
Page 11: ...1 Before You Start ...
Page 20: ...Chapter 1 Before You Start Related Documentation 1 10 Programming Guide 1 ...
Page 21: ...2 Command Summary A Quick Reference ...
Page 41: ...3 Programming Your Counter for Remote Operation ...
Page 101: ...4 Command Reference A Dictionary ...
Page 162: ...Chapter 4 Command Reference Common Commands 4 62 Programming Guide 4 ...
Page 163: ...5 Errors ...
Page 174: ...Chapter 5 Errors Error Types 5 12 Programming Guide 5 ...
Page 184: ......
Page 186: ... Manual Part Number 53150 90002 Printed in U S A NOVEMBER 1997 ...