Chapter 3 Programming Your Universal Counter for Remote Operation
Elements of SCPI Commands
Programming Guide
3-77
To Make a Frequency Measurement (QuickBASIC)
'This program sets up the counter to make 10 frequency measurements
'on channel 1 using a 0.1 second gate time.
'The results are printed on the computer CRT.
'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& = 7 'Select code 7
state% = 1 'Used in IOEOI
CLS 'Clear screen
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
CALL sendhp(":func " + CHR$(34) + "FREQ 1" + CHR$(34)) 'Measure frequency
CALL sendhp(":FREQ:ARM:STAR:SOUR IMM") 'These 3 lines enable using
CALL sendhp(":FREQ:ARM:STOP:SOUR TIM") 'time arming with a 0.1 second
CALL sendhp(":FREQ:ARM:STOP:TIM .1") 'gate time
CLS 'Clear computer screen
FOR i = 1 TO samples
CALL sendhp("READ:FREQ?") 'Initiate a measurement and
'get the result
CALL IOENTERS(source&, freqs(i), 23, actf%) 'Read the ASCII characters
PRINT "Frequency"; i; "= "; freqs(i)
NEXT i
END
SUB sendhp (code$)
CALL iooutputs(source, code$, LEN(code$))
END SUB
Summary of Contents for 53131A
Page 1: ...Programming Guide HP 53131A 132A 225 MHz Universal Counter ...
Page 2: ......
Page 13: ...1 1 Before You Start ...
Page 24: ...Chapter 1 Before You Start Related Documentation 1 12 Programming Guide ...
Page 25: ...2 2 Command Summary A Quick Reference ...
Page 68: ...Chapter 2 Command Summary RST Response 2 44 Programming Guide ...
Page 69: ...3 3 Programming Your Universal Counter for Remote Operation ...
Page 167: ...4 4 Command Reference A Dictionary ...
Page 310: ...Chapter 4 Command Reference WAI Wait to Continue Command 4 144 Programming Guide ...
Page 311: ...5 5 Errors ...
Page 329: ......
Page 330: ...H Manual Part Number 53131 90044 Printed in U S A NOVEMBER 1996 ...