11-20 Status Structure Model 2700 Multimeter/Switch System User’s Manual
Programming examples
Example 1 – Program and read a register set
NOTE The following example can be run from the KE2700 Instrument Driver using the
example named “Prmr” in
Table H-1 of Appendix H.
The following command sequence programs and reads the measurement register set:
STAT:MEAS:ENAB 512 ' Enable BFL (buffer full).
STAT:MEAS:COND? ' Read Measurement Condition Register.
STAT:MEAS? ' Read Measurement Event Register.
NOTE Examples 2 and 3 demonstrate the proper method to read an individual bit of an
event register. In general, the state of an event register bit is determined by
enabling the event bit, then reading the status byte (*STB?).
Example 2 – Read RAV bit of measurement event register
The following command sequence demonstrates the proper method to read the RAV bit of
the measurement event register:
*RST ' Put 2700 in “one-shot” mode.
*CLS ' Clear measurement event register.
STAT:PRES ' Clear measurement event enable register.
STAT:MEAS:ENAB 32 ' Enable RAV bit (B5) of the measurement event register.
INIT ' Trigger one measurement.
*STB? ' Read status byte register.
*CLS and STAT:PRES resets the measurement register bits to zero. The :ENAB command
enables the reading available bit B5 (RAV) of the measurement event register. When a
reading is triggered and becomes available, bit B0 (MSB) of the status byte will set. INIT
triggers a reading and *STB? reads the status byte.
Since you are only interested in bit B0 of the status byte, it is recommended that your pro-
gram routine mask out the other bits, which may also be set. For example, *STB? may
return decimal “17”. The binary bit pattern for decimal 17 is as follows:
B7 B6 B5 B4 B3 B2 B1 B0
0 0 0 1 0 0 0 1*STB? returns decimal “17” (B4 and B0 set)
If, in your program, you logically AND the above returned binary value with 00000001,
you will mask out bits B1 through B7:
B7 B6 B5 B4 B3 B2 B1 B0
0 0 0 1 0 0 0 1*STB? returns decimal 17 (B0 and B4 set)
0 0 0 0 0 0 0 1Mask to read B0 (decimal 1)
__________________________________
0 0 0 0 0 0 0 1 Result of logic AND operation (decimal 1)