5700A/5720A Series II
Operators Manual
5-50
5-30. Reading the ESR and ESE
To read the contents of the ESR, send the remote command, *ESR?. The ESR is cleared
(set to 0) every time it is read. To read the contents of the ESE, send the remote
command, *ESE?. The ESE is not cleared when it is read. When you read either register,
the calibrator responds by sending a decimal number that represents bits 0 through 15.
The following sample program retrieves the contents of both registers:
1Ø ! THIS PROGRAM READS THE ESR AND THE ESE REGISTERS
2Ø PRINT @4, “*ESR?”! ASK FOR THE ESR CONTENTS
3Ø INPUT @4, A! RETRIEVE THE REGISTER CONTENTS
4Ø PRINT @4, “*ESE?”! ASK FOR THE ESE CONTENTS
5Ø INPUT @4, B! RETRIEVE THE REGISTER CONTENTS
6Ø PRINT “ESR = “;A ! DISPLAY THE ESR REGISTER CONTENTS VALUE
7Ø PRINT “ESE = “;B ! DISPLAY THE ESE REGISTER CONTENTS VALUE
8Ø END
Convert the contents of variables A and B into binary, and you can read the status of the
registers. For example if A is 32, its binary equivalent is: 00000000 00100000. Therefore,
bit 5 (CME) in the ESR is set (1) and the rest of the bits are reset (0). This tells you that
the calibrator has encountered a command fault. (It tried to execute an incorrectly formed
command.)
5-31. Loading the ESE
By resetting the bits in the ESE, you can mask (disable) the associated bits in the ESR.
For example, to prevent the occurrence of a command fault from causing bit 5 (ESB) in
the serial poll status byte to go to 1, you can reset (to 0) bit 5 in the ESE register. The
following sample program accomplishes this by checking the status of the CME bit, then
toggling it if it is 1.
1Ø ! THIS PROGRAM RESETS BIT 5 (CME) IN THE ESE
2Ø PRINT @4,”*ESE 33” ! INITIAL ESE <-- EXE + OPC
3Ø GOSUB ! GET AND PRINT INITIAL ESE
4Ø IF (A% AND 32%) THEN A% = A% - 32% ! CLEAR EXE (BIT 5)
5Ø PRINT @4, “*ESE?” ! LOAD THE ESE WITH THE NEW VALUE
6Ø GOSUB 8Ø ! GET AND PRINT NEW ESE
7Ø END
8Ø PRINT @4, “*ESE?” !ASK FOR THE ESE CONTENTS
9Ø INPUT @4, A% !RETRIEVE THE REGISTER CONTENTS
1ØØ PRINT “ESE = “;A%
11Ø RETURN