Error Detection

The power supply can recognize programming errors and can inform you when a programming error occurs. When an error is detected, no attempt is made to execute the command. Instead, a bit in the serial poll register is set. If SRQ2 or SRQ3 is set, an interrupt will be generated. The following program checks for programming errors and can be entered and run as is. While it is running, commands can be sent to the power supply from the keyboard. If the ERROR annunciator on the power supply's front panel indicates that an error has been detected, depress the labeled softkey to display the error on your computer screen.

10 ASSIGN @Ps TO 705

20 COM /Ps/ @Ps

30 ON KEY 0 LABEL "ERROR?" CALL Err_trap

40 Lbl: GOTO Lbl

50END

60!

70!

80SUB Err _ trap

90OFF KEY

100COM /Ps/ @Ps

110OUTPUT @Ps;"ERR?''

120ENTER @Ps;Err

130OUTPUT 2 USING "#,K";CHR$(255)&CHR$(75)

140IF Err THEN

150PRINT "POWER SUPPLY PROGRAMMING ERROR:"

160END IF

170SELECT Err

180CASE 0

190PRINT "NO ERROR OCCURRED"

200SUBEXIT

210CASE 1

220PRINT "INVALID CHARACTER"

230CASE 2

240PRINT "INVALID NUMBER"

250CASE 3

260PRINT "INVALID STRING"

270CASE 4

280PRINT ''SYNTAX ERROR"

290CASE 5

300PRINT "NUMBER OUT OF RANGE"

310CASE 6

320PRINT "DATA REQUESTED WlTHOUT QUERY"

330CASE 7

340PRINT "STRING EXCEEDS DISPLAY LENGTH"

350CASE 8

360PRINT "NUMBER TOO LARGE FOR INPUT BUFFER"

370CASE 28

380PRINT ''INVALID CHARACTERS IN STRING"

390CASE ELSE

400PRINT ''UNRECOGNIZED ERROR NUMBER"; Err

410END SELECT

420PRINT "RE-ENTER STATEMENT AND TRY AGAIN"

430SUBEND

Programming with a Series 200/300 Computer101