Intermec PC23d Fingerprint Developer's Guide (PC23d, PC43d/t, PM23c, PM43, PM4 - Page 31

Using an ON BREAK...GOSUB Instruction, Understanding Fingerprint Syntax

Page 31 highlights

Chapter 2 - Understanding Fingerprint Syntax ON...GOTO is shown in this example: 10 20 30 1000 2000 3000 RUN INPUT "Press key 1, 2, or 3 on host: ", A% ON A% GOTO 1000, 2000, 3000 END PRINT "You have pressed key 1": GOTO 30 PRINT "You have pressed key 2": GOTO 30 PRINT "You have pressed key 3": GOTO 30 Using an ON BREAK...GOSUB Instruction When a BREAK condition occurs on a specified device, the execution is interrupted and branched to a specified subroutine. For example, the program can make the printer emit a sound or display a message before the program is terminated. You can also let the program execution continue along a different path. In the next example, the program is interrupted when the Shift and Pause keys on the printer keyboard are pressed. The execution branches to a subroutine, which emits a siren-sounding signal three times. Then the execution returns to the main program, which is indicated by a long shrill signal. 10 20 30 40 50 60 70 1000 1010 1020 1030 1040 RUN BREAK 1,35 BREAK 1 ON ON BREAK 0 GOSUB 1000:REM Break from keyboard ON BREAK 1 GOSUB 1000:REM Break from host (#) GOTO 50 SOUND 800,100 BREAK 1 OFF: END FOR A%=1 TO 3 SOUND 440,50 SOUND 349,50 NEXT A% GOTO 60 Using an ON COMSET...GOSUB Instruction When one of several specified conditions interrupts the background communication on a certain communication channel, the program branches to a subroutine, such as reading the buffer. The interrupt conditions (end character, attention string, or maximum number of characters) are specified by a COMSET statement as in this example: 1 10 20 30 40 50 60 1000 2000 2010 2020 2030 REM Exit program with #STOP& COMSET1,"#","&","ZYX","=",50 ON COMSET 1 GOSUB 2000 COMSET 1 ON IF A$ "STOP" THEN GOTO 40 COMSET 1 OFF END END A$= COMBUF$(1) PRINT A$ COMSET 1 ON RETURN Fingerprint Developer's Guide 19

  • 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

Chapter 2 — Understanding Fingerprint Syntax
Fingerprint Developer’s Guide
19
ON...GOTO is shown in this example:
10
INPUT “Press key 1, 2, or 3 on host: ”, A%
20
ON A% GOTO 1000, 2000, 3000
30
END
1000
PRINT “You have pressed key 1”: GOTO 30
2000
PRINT “You have pressed key 2”: GOTO 30
3000
PRINT “You have pressed key 3”: GOTO 30
RUN
Using an ON BREAK...GOSUB Instruction
When a BREAK condition occurs on a specified device, the execution is interrupted
and branched to a specified subroutine. For example, the program can make the
printer emit a sound or display a message before the program is terminated. You can
also let the program execution continue along a different path.
In the next example, the program is interrupted when the
Shift
and
Pause
keys on
the printer keyboard are pressed. The execution branches to a subroutine, which
emits a siren-sounding signal three times. Then the execution returns to the main
program, which is indicated by a long shrill signal.
10
BREAK 1,35
20
BREAK 1 ON
30
ON BREAK 0 GOSUB 1000:REM Break from keyboard
40
ON BREAK 1 GOSUB 1000:REM Break from host (#)
50
GOTO 50
60
SOUND 800,100
70
BREAK 1 OFF: END
1000
FOR A%=1 TO 3
1010
SOUND 440,50
1020
SOUND 349,50
1030
NEXT A%
1040
GOTO 60
RUN
Using an ON COMSET...GOSUB Instruction
When one of several specified conditions interrupts the background
communication on a certain communication channel, the program branches to a
subroutine, such as reading the buffer. The interrupt conditions (end character,
attention string, or maximum number of characters) are specified by a COMSET
statement as in this example:
1
REM Exit program with #STOP&
10
COMSET1,“#”,“&”,“ZYX”,“=”,50
20
ON COMSET 1 GOSUB 2000
30
COMSET 1 ON
40
IF A$ <> “STOP” THEN GOTO 40
50
COMSET 1 OFF
60
END
1000
END
2000
A$= COMBUF$(1)
2010
PRINT A$
2020
COMSET 1 ON
2030
RETURN