Programming instructions

163
Intermec Fingerprint 6.13 – Programmer's Guide
3. Creating an Error-
Handling Routine,
cont'd.
16. ERROR-HANDLING, cont'd.
Example:
The four instructions described above can be used to branch to a
subroutine, identify the error, branch to a secondary subroutine
where the error is cleared and resume the execution. In the example
only one error condition 1019 “Invalid Font” is taken care of, but
the same principles can be used for more errors. You can test the
example by either adding a valid font name or lifting the printhead
before running the program.
10 OPEN "console:" FOR OUTPUT AS 1
20 ON ERROR GOTO 1000
30 PRPOS 50,100
40 PRTXT "HELLO"
50 PRINTFEED
60 A%=TICKS+400
70 B%=TICKS
80 IF B%<A% THEN GOTO 70 ELSE GOTO 90
90 PRINT #1 : PRINT #1
100 END
1000 SOUND 880,50
1010 EFLAG%=ERR : ELINE%=ERL
1020 IF EFLAG%=1019 THEN GOTO 2000 ELSE GOTO 3000
2000 PRINT #1 : PRINT #1
2010 PRINT #1, "Font missing"
2020 PRINT #1, "in line ", ELINE%;
2030 FONT "SW030RSN" : MAG 2,2 : INVIMAGE
2040 RESUME
3000 PRINT #1 : PRINT #1
3010 PRINT #1, "Undefined error"
3020 PRINT #1, "Program Stops!";
3030 RESUME NEXT
PRSTAT
Another instruction that can be used in connection with error-
handling is the PRSTAT function. In addition to returning the
current position of the insertion point (see chapter 10.1), it can also
return the printer's status in regard several conditions, using a
logical operator:
IF PRSTAT (AND 0) Ok
IF PRSTAT (AND 1) Printhead lifted
IF PRSTAT (AND 2) Label not removed (LTS only)
IF PRSTAT (AND 4) Printer out of paper
IF PRSTAT (AND 8) Printer out of transfer ribbon
IF PRSTAT (AND 16) Printhead voltage too high
IF PRSTAT (AND 32) Printer is feeding
Multiple simultaneous errors are indicated by the sum of the values
for each error, e.g. if both the printhead is lifted (1) and the printer
is out paper (4) and ribbon (8), it can be detected by:
IF PRSTAT (AND 13)
Logical Operators
Also see:
Chapter 4.9