Programming instructions

75
Intermec Fingerprint 6.13 – Programmer's Guide
7. INPUT TO FINGERPRINT, cont'd.
8. Background
Communication, cont'd.
Continued!
Decide what will happen, when the reception is interrupted, by
specifying a subroutine to which the execution will branch, using
an ON COMSET GOSUB statement.
Interruption will occur when any of the following conditions is
fulfilled:
- an end character is received.
- an attention string is received.
- the maximum number of characters have been received.
Example:
When the reception of data on communication channel 1 ("uart1:")
is interrupted, the execution will branch to a subroutine starting
on line number 1000.
70 ON COMSET 1 GOSUB 1000
After returning from the subroutine, use a COMSET ON statement
to empty the buffer and turn on background reception again. e.g.:
80 COMSET 1 ON
When the reception has been interrupted, it is time to see what the
buffer contains. You can read the content of the buffer, e.g. 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 reason of interruption as specified by COMSET:
- Max. number of characters received (2).
- End character received (4).
- Attention string received (8).
- Communication error (32).
Example:
The various cases of interruption makes different messages to be
printed to the standard OUT channel.
1010 IF COMSTAT(1) AND 2 THEN PRINT A$
1020 IF COMSTAT(1) AND 4 THEN PRINT B$
1030 IF COMSTAT(1) AND 8 THEN PRINT C$
1040 IF COMSTAT(1) AND 32 THEN PRINT D$
If you want to temporarily turn off background reception during
some part of the program execution, you can issue a COMSET
OFF statement and then turn off the background reception again
using a new COMSET ON statement. Remember that the
COMSET ON/OFF statements empties the buffer and the content
will be lost if you do not read it first, using a COMBUF$ function.