Intermec PB51 Fingerprint Developer's Guide (old) - Page 149

Error Handling Example

Page 149 highlights

Chapter 8 - Error Handling Multiple errors are indicated by the sum of the values. For example, if the printhead is lifted (1), and the printer is out of media (128) and ribbon (8), then PRSTAT returns 137. To speed up execution when several conditions are to be checked, assign the PRSTAT value to a numeric variable, for example: 10 A% = PRSTAT 20 IF A% (AND 1) GOTO 1000 30 IF A% (AND 2) GOTO 2000 ... For more information, see PRSTAT in the Fingerprint Command Reference Manual. Error Handling Example In this example one error condition (Error 1019, "Invalid Font") is managed. The same principles can be used for more errors. Test the example by either adding a valid font name or lifting the printhead before running the program. 10 20 30 40 50 60 70 80 90 100 1000 1010 1020 2000 2010 2020 2030 2040 3000 3010 3020 3030 RUN OPEN "console:" FOR OUTPUT AS 1 ON ERROR GOTO 1000 PRPOS 50,100 PRTXT "HELLO" PRINTFEED A%=TICKS+400 B%=TICKS IF B%

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187

Chapter 8 — Error Handling
Intermec Fingerprint Developer’s Guide
133
Multiple errors are indicated by the sum of the values. For example, if the printhead
is lifted (1), and the printer is out of media (128) and ribbon (8), then PRSTAT
returns 137.
To speed up execution when several conditions are to be checked, assign the
PRSTAT value to a numeric variable, for example:
10
A% = PRSTAT
20
IF A% (AND 1) GOTO 1000
30
IF A% (AND 2) GOTO 2000
...
For more information, see PRSTAT in the
Fingerprint Command Reference Manual.
Error Handling Example
In this example one error condition (Error 1019, “Invalid Font”) is managed. The
same principles can be used for more errors. 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 “Swiss 721 BT”,24 : INVIMAGE
2040 RESUME
3000
PRINT #1 : PRINT #1
3010
PRINT #1, “Undefined error”
3020
PRINT #1, “Program Stops!”;
3030
RESUME NEXT
RUN