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

If Q% And 4 Then Print B

Page 65 highlights

Chapter 4 - Managing Input and Output In this example, the background reception is set to channel "uart1:", the Start character is A, the End character is CHR$ (90) (the character Z), the character to be ignored is #, the attention string is BREAK, and the maximum number of characters in the buffer is 20: 60 COMSET 1,"A",CHR$(90),"#","BREAK",20 3 Use an ON COMSET GOSUB statement to specify a subroutine to branch to when reception is interrupted. Interruption occurs when any of the following conditions are fulfilled: • an end character is received. • an attention string is received. • the maximum number of characters have been received. In this example, when the reception of data on communication channel 1 ("uart1:") is interrupted, the execution branches to a subroutine starting on line number 1000. 70 ON COMSET 1 GOSUB 1000 4 Turn on the COMSET: 80 COMSET 1 ON Note: The COMSET interrupt must be turned on after it has occurred and been resolved. 5 When reception is interrupted, check the buffer contents. You can read the content of the buffer (for example, to a string variable) using a COMBUF$ function: 1000 QDATA$=COMBUF$(1) The COMSTAT function can be used to detect what has caused the interruption. Use the logical operator AND to detect the following four reasons of interruption as specified by COMSET: • Max. number of characters received (2). • End character received (4). • Attention string received (8). • Communication error (32). Different messages to be printed to the standard OUT channel, depending on what interrupted communication. By assigning the COMSTAT value to a numeric variable, execution is faster than checking the COMSTAT value several times for different values, as seen in this example: 1010 Q% = COMSTAT (1) 1020 IF Q% AND 2 THEN PRINT A$ 1030 IF Q% AND 4 THEN PRINT B$ 1040 IF Q% AND 8 THEN PRINT C$ 1050 IF Q% AND 32 THEN PRINT D$ Fingerprint Developer's Guide 53

  • 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 4 — Managing Input and Output
Fingerprint Developer’s Guide
53
In this example, the background reception is set to channel “uart1:”, the Start
character is A, the End character is CHR$ (90) (the character Z), the character to
be ignored is #, the attention string is BREAK, and the maximum number of
characters in the buffer is 20:
60 COMSET 1,“A”,CHR$(90),“#”,“BREAK”,20
3
Use an ON COMSET GOSUB statement to specify a subroutine to branch to
when reception is interrupted. Interruption occurs when any of the following
conditions are fulfilled:
an end character is received.
an attention string is received.
the maximum number of characters have been received.
In this example, when the reception of data on communication channel 1
(“uart1:”) is interrupted, the execution branches to a subroutine starting on line
number 1000.
70 ON COMSET 1 GOSUB 1000
4
Turn on the COMSET:
80 COMSET 1 ON
5
When reception is interrupted, check the buffer contents. You can read the
content of the buffer (for example, to a string variable) using a COMBUF$
function:
1000 QDATA$=COMBUF$(1)
The COMSTAT function can be used to detect what has caused the interruption.
Use the logical operator AND to detect the following four reasons of
interruption as specified by COMSET:
Max. number of characters received (2).
End character received (4).
Attention string received (8).
Communication error (32).
Different messages to be printed to the standard OUT channel, depending on
what interrupted communication. By assigning the COMSTAT value to a
numeric variable, execution is faster than checking the COMSTAT value several
times for different values, as seen in this example:
1010 Q% = COMSTAT (1)
1020 IF Q% AND 2 THEN PRINT A$
1030 IF Q% AND 4 THEN PRINT B$
1040 IF Q% AND 8 THEN PRINT C$
1050 IF Q% AND 32 THEN PRINT D$
Note:
The COMSET interrupt must be turned on after it has occurred and been
resolved.