HP 132A, 53131A manual Programming Examples

Models: 132A 53131A

1 330
Download 330 pages 55.08 Kb
Page 150
Image 150
DECLARE SUB sendhp (code$) REM $INCLUDE: 'QBSETUP.BAS' DIM SHARED source AS LONG DIM status AS INTEGER
DIM complete AS INTEGER DIM statusbyte AS INTEGER DIM maximum AS STRING * 23 DIM minimum AS STRING * 23 DIM mean AS STRING * 23 DIM sdev AS STRING * 23 DIM nummeas AS INTEGER DIM lower AS SINGLE
DIM upper AS SINGLE nummeas = 50 lower = .0000005 upper = .000001 actual% = 0 maxelem% = 23 source& = 703 isc& = 7 complete = 0 state% = 1 priority% = 1
CLS
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 Use Limits to Filter Data Before Measuring Stats (QuickBASIC)

'This program sets up the counter to determine the statistics of

'50 period measurements that are within limits defined by the variables ''UPPER' and 'LOWER'. Periods that are outside of the limits are not 'included in the statistics. The Limit graph is displayed so you can see if 'measurements are in limit.

'To alert the program that the statistics are ready, bit 8 in the Operation 'Status register is used. When statistics are being calculated, this bit 'is high, when they are complete, the bit goes low. By using the transition 'filters, an SRQ can be generated when statistics are complete.

'The SUB sendhp sends commands to the counter

'Required by HP 82335A 'Address and select code 'Status byte variable 'Variable used in the program 'Status Byte variable 'Strings used to enter stats

'Number of measurements 'Lower limit

'Upper limit

'Number of statistics measurements 'Limit values

'Used in IOENTERS

'Used in IOENTERS 'Counter at address 3 'Select code 7

'Used to check if stats received 'Used in IOEOI

'Used in IOPEN

'Make sure EOI enabled 'Reset counter and interface 'Reset counter

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

3-82

Programming Guide

Page 150
Image 150
HP 132A, 53131A manual Programming Examples