Intermec PC43d Fingerprint Developer's Guide (PC23d, PC43d/t, PM23c, PM43, PM4 - Page 65
If Q% And 4 Then Print B
View all Intermec PC43d manuals
Add to My Manuals
Save this manual to your list of manuals |
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