Chapter 3 Programming Your Universal Counter for Remote Operation

Elements of SCPI Commands

To Measure the Statistics of 50 Measurements (QuickBASIC) (Continued)

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") CALL sendhp(":FREQ:ARM:STOP:SOUR TIM") CALL sendhp(":FREQ:ARM:STOP:TIM .01")

'These 3 lines enable using 'time arming with a 0.01 second 'gate time

CALL sendhp(":DISP:TEXT:FEED " + CHR$(34) + "CALC3" + CHR$(34)) 'Display stats

CALL sendhp(":CALC3:AVER:TYPE SDEV")

'Display the standard deviation

CALL sendhp(":CALC3:AVER ON")

'Enable statistics

CALL sendhp(":CALC3:AVER:COUNT " + STR$(samples)) 'Do stats on samples

CALL sendhp(":TRIG:COUNT:AUTO ON")

'Take samples measurements

CALL sendhp("*ESE 1")

'"*ESE 1" is used so the

 

'correct bit is summarized

CALL sendhp("*SRE 32")

'in the Status Byte Register

PRINT "Waiting for measurement to complete"

'when the measurement is complete

 

ON PEN GOSUB statsready

'Wait for interrupt

PEN ON

 

CALL IOPEN(isc&, priorty%)

 

CALL sendhp(":INIT;*OPC")

'Enable OPC bit and start meas

loophere:

 

IF complete THEN GOTO endprogram

'Wait here, if already made

GOTO loophere

'stats measurements, then goto

 

'endprogram.

statsready:

'Ready to read statistics

CALL sendhp(":CALC3:AVERAGE:TYPE MIN;:CALC3:DATA?") 'Read them individually CALL IOENTERS(source&, minimum, maxelem%, actual%)

CALL sendhp(":CALC3:AVERAGE:TYPE MAX;:CALC3:DATA?") CALL IOENTERS(source&, maximum, maxelem%, actual%) CALL sendhp(":CALC3:AVERAGE:TYPE MEAN;:CALC3:DATA?") CALL IOENTERS(source&, mean, maxelem%, actual%) CALL sendhp(":CALC3:AVERAGE:TYPE SDEV;:CALC3:DATA?") CALL IOENTERS(source&, sdev, maxelem%, actual%)

PRINT

 

PRINT "Minimum Period

= ", minimum

PRINT "Maximum Period

= ", maximum

PRINT "Mean Period

= ", mean

PRINT "Standard Deviation = ", sdev

complete = 1

 

RETURN

 

endprogram:

'All done!

SUB sendhp (code$)

CALL iooutputs(source, code$, LEN(code$))

END SUB

Programming Guide

3-81

Page 149
Image 149
HP 53131A, 132A manual On PEN Gosub statsready Wait for interrupt