Programming Examples

5. Status Reporting

This program sets up the status reporting for Service Request on ‘Message Available’ and ‘Command’, ‘Execution’, or Query’ errors.

The program reads a command from the controller keyboard and sends it to the coun- ter, then it checks the status byte using Serial Poll. It determines the reason for Service Request, and reads query responses and error messages.

50 CNTNAME$ = “DEV10"

60 CALL IBFIND (CNTNAME$, CNT%)

70

80

90—— CLEAR STATUS ——

100WRT$ = “*cls”

110CALL IBWRT (CNT%, WRT$)

120

130—— SET EVENT STATUS ENABLE ——

140‘ Enable Command Error, Execution Error and Query Error

150WRT$ = “*ese 52"

160CALL IBWRT (CNT%, WRT$)

170

180—— SET SERVICE REQUEST ENABLE ——

190‘ Enable Service Request on Event Status and Message Available

200WRT$ = “*sre 48"

210CALL IBWRT (CNT%, WRT$)

220

230‘ ======== MAIN LOOP =======================================

240WHILE 1

250

260—— ENTER COMMAND STRING AND SEND TO COUNTER ——

270LINE INPUT “Enter command string (<CR> to end):”, CMD$

280IF CMD$ = “” GOTO 760

290CMD$ = CMD$

300CALL IBWRT (CNT%, CMD$)

310‘ WAIT for execution

320FOR I=1 TO 1000

330CALL IBRSP (CNT%, SPR%)

340IF SPR% AND 16 THEN GOTO 380

350NEXT I

360

370—— READ STATUS BYTE ——

380IF SPR% <> 0 THEN PRINT “Status byte = ”; SPR%

390ELSE GOTO 750

400

GW-Basic for National Instruments PC-IIA, Setting Up the Interface 4-9

Page 49
Image 49
Fluke PM6681R, PM6685R manual Status Reporting, 130 ‘ -- SET Event Status Enable, 180 ‘ -- SET Service Request Enable