![Agilent Technologies 8156A Operating And Programming Manual Download Page 135](http://html.mh-extra.com/html/agilent-technologies/8156a/8156a_operating-and-programming-manual_2868603135.webp)
134
Programming Examples
Example 2 - Status Registers and Queues
890
Value=Value-Bit
900
!
910
! If MAV is set, then get and display the output que
ue contents
920
!
930
IF Z=0 THEN
940
IF Bit=16 THEN
950
ENTER Att;A$
960
PRINT TABXY(21,18);A$
970
END IF
980
END IF
990
!
1000
! If the bit is not set, then display 0
1010
!
1020
ELSE
1030
PRINT TABXY(Xpos,Ypos);"0"
1040
END IF
1050
!
1060
! Set up for the next iteration
1070
!
1080
Bit=Bit DIV 2
1090
Xpos=Xpos+4
1100
UNTIL Bit=0
1110
!
1120
! Now that the status byte is displayed, get the Standar
d Events
1130
! Status Register
1140
!
1150
OUTPUT Att;"*ESR?"
1160
ENTER Att;Value
1170
!
1180
! Set up to display the ESR
1190
!
1200
Ypos=12
1210
NEXT Z
1220
!
1230
! Read and display any messages in the error queue
1240
!
1250
REPEAT
1260
OUTPUT Att;"SYSTEM:ERROR?"
1270
ENTER Att;Value,A$
The SYSTEM:ERROR? query gets the number of the last error in the error queue.
1280
IF Value<>0 THEN PRINT TABXY(21,17);Value,A$
1290
UNTIL Value=0
1300
!
1310
! Clear the Status structure and reenable the interrupt be
fore returning
1320
!
1330
OUTPUT Att;"*CLS"
1340
ENABLE INTR 7
1350
!
1360
RETURN
1370
!
1380
END
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com