Chapter 3 Programming Your Universal Counter for Remote Operation

Programming Examples

To Read and Store Calibration Information (HP BASIC)

10 !This program reads the calibration data for the counter into an array.

20 !Before calibrating the counter, it is a good idea to read

30 !and store the current values in case something goes wrong with the 40 !calibration.

50 !In this program, the calibration values are stored in the array cal_data. 60 !Normally, you would store the calibration data on a disk for safe

70 !keeping. The calibration values should only be changed by running the 80 ! calibration diagnostics.

90 !

100

DIM Cal_data$[57]

! Array to hold calibration data

110

DIM Err_string$[255]

! Array to hold error message

120

CLEAR SCREEN

 

130

ASSIGN @Count TO 703

! Assign I/O path for HP 53131A

140

CLEAR @Count

 

150

OUTPUT @Count;"*RST"

! Reset the HP 53131A

160

OUTPUT @Count;"*CLS"

! Clear event registers and error queue

170

OUTPUT @Count;"*SRE 0"

! Clear service request enable register

180

OUTPUT @Count;"*ESE 0"

! Clear event status enable register

190

OUTPUT @Count;":STAT:PRES"

! Preset enable registers and

200

 

! transition filters for operation and

210

 

! questionable status structures.

220

OUTPUT @Count;":CAL:DATA?"

! Ask for data

230ENTER @Count USING "#,4A";Head1$

240ENTER @Count USING "%,K";Cal_data$

250PRINT "Calibration data now in array Cal_data"

260! You may want to store Cal_data$ and Head1$ on a disk.

270! If, at some later point, you need to send the calibration data

280! back to the counter, you would use the following command:

290! OUTPUT @Count;":CAL:DATA ";Head1$&Cal_data$ ! Send calibration data

300! REPEAT

310! OUTPUT @Count;"SYST:ERR?"

320! ENTER @Count;Err_num,Err_string$

330! IF Err_num<>0 THEN

340! PRINT Err_num,Err_string$

350! END IF

360! UNTIL Err_num=0

370END

3-68

Programming Guide

Page 136
Image 136
HP 132A, 53131A manual To Read and Store Calibration Information HP Basic