HP 132A User Manual Page 148

  • Download
  • Add to my manuals
  • Print
  • Page
    / 330
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 147
Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-80 Programming Guide
To Measure the Statistics of 50 Measurements (QuickBASIC)
'This program instructs the counter to take 50 period measurements
'and return the mean, minimum, maximum and standard deviation.
'The counter is put into SINGLE measurement mode.
'The number of measurements is programmed using ":CALC3:AVER:COUNT 50"
'The counter is set up to take 50 measurements and then stop
'using the ":TRIG:COUNT:AUTO ON" command.
'At the end of the 50 measurements, the statistics are sent to the
'computer. The data is sent in ASCII format to preserve resolution.
'
'When the program has completed, the statistics will be displayed on
'the computer and the standard deviation will be displayed on the
'counter
'
'In this example, the status reporting structure is used to alert the
'program that the statistics are ready.
'The "*OPC" and "*ESE 1" command are used together to generate an output
'from the Event Status Register when the measurement is complete. The
'output of this register is summarized in the Status Byte Register
'In order for the Service Request Register to summarize that input
'the "*SRE 128" command must be used. This enables the Service
'Request Register to assert the SRQ line when the measurement is complete.
'Note that the *OPC command must be sent at the start of every measurement.
'
'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 samples AS INTEGER 'Number of measurements
DIM maximum AS STRING * 23 'Strings for statistics
DIM minimum AS STRING * 23 'The maximum number of characters that
DIM mean AS STRING * 23 'can ever be sent is 23
DIM sdev AS STRING * 23
maxelem% = 23 'Maximum number of characters expected
actual% = 0 'Returns actual characters received
samples = 50 'Number of statistics measurements
source = 703 'Counter at address 3
isc& = 7 'Select code 7
state% = 1 'Used in IOEOI
priority% = 1 'Used in IOPEN
CLS
CALL IOEOI(isc&, state%) 'Make sure EOI enabled
CALL IOCLEAR(source&) 'Reset the counter and interface
CALL sendhp("*RST") 'Reset the 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.
Page view 147
1 2 ... 143 144 145 146 147 148 149 150 151 152 153 ... 329 330

Comments to this Manuals

No comments