Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-78
Programming Guide
To Perform Limit Testing (QuickBASIC)
'This program sets up the counter to make period measurements
'indefinitely until an out of limits measurement occurs. The upper
'limit is set to 1 us and the lower limit is set to 500 ns.
'If a measurement falls outside of these limits, the counter will
'stop measuring and send the out of limits period to the computer.
'The out of limit period 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 period AS STRING * 23 'Period string, the maximum number
'of characters that can ever be
'sent is 23
DIM complete AS INTEGER '
DIM statusbyte AS INTEGER 'Status byte variable
upper = .000001 'Upper period
lower = .0000005 'lower period
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 'Clear the 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 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"
CALL sendhp(":FREQ:ARM:STAR:SOUR IMM") 'These 2 lines enable using
CALL sendhp(":FREQ:ARM:STOP:SOUR IMM") 'automatic arming
CALL sendhp(":CALC2:LIM:STAT ON") 'Enable limit testing
CALL sendhp(":CALC2:LIM:DISP GRAP") 'Show the analog limit graph
CALL sendhp(":CALC2:LIM:LOWER " + STR$(lower)) 'Set lower limit
CALL sendhp(":CALC2:LIM:UPPER " + STR$(upper)) 'Set upper limit
CALL sendhp(":INIT:AUTO ON") 'Stop when out of limit
CALL sendhp("*SRE 8") 'Enable SRQ on questionable data
'register event
CALL sendhp(":STAT:QUES:ENAB 1024") '1024 is out of limit bit
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 ...