HP (Hewlett-Packard) 132A Water Dispenser User Manual


 
Chapter 3 Programming Your Universal Counter for Remote Operation
Elements of SCPI Commands
Programming Guide 3-85
To Read and Store Calibration Data (QuickBASIC)
'Before calibrating the counter, it is a good idea to read
'and store the current calibration values in case something goes wrong with
'the calibration.
'This program reads the cal values, and stores them in a file on the computer
'hard drive. It then reads the data from the file and sends it back to
'the counter.
'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 CALDATA AS STRING * 61 'Strings to be read
source& = 703 'Counter at address 3
isc& = 7 'Select code 7
state% = 1
CLS 0
CALL IOEOI(isc&, state%) 'Make sure EOI enabled
CALL IOCLEAR(source&) 'Clear the counter and interface
CALL sendhp("*RST") 'Reset HP 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.
PRINT "Reading Calibration Data"
CALL sendhp(":CAL:DATA?")
CALL ioenters(source&, CALDATA, 61, actf%) 'Read the ASCII characters
OPEN "CALDATA.DAT" FOR BINARY AS #1 'Store the cal data in a file
PUT #1, 1, CALDATA
CLOSE #1
'The following lines show how to open a file with calibration data
'and send it back to the counter.
PRINT
PRINT "Sending calibration data to counter"
OPEN "CALDATA.DAT" FOR BINARY AS #1
GET #1, 1, CALDATA
CLOSE #1
CALL sendhp(":CAL:DATA " + CALDATA) 'Send the data just read to counter
END
SUB sendhp (code$)
CALL iooutputs(source, code$, LEN(code$))
END SUB