Intermec PM43/PM43c Fingerprint Developer's Guide (PC23d, PC43d/t, PM23c, PM43 - Page 32
Using an ON KEY...GOSUB Instruction, Unconditional Branching Using a GOTO Statement
View all Intermec PM43/PM43c manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 32 highlights
Chapter 2 - Understanding Fingerprint Syntax Using an ON KEY...GOSUB Instruction To use the printer keypad, each key can be enabled individually using a KEY ON statement and assigned to a subroutine using an ON KEY GOSUB statement. The subroutine should contain the instructions you want performed when the key is pressed. In the statements KEY () ON, KEY () OFF, and ON KEY () GOSUB..., the keys are specified by id. numbers enclosed by parentheses. For more information, see "Using the Printer Keypad" on page 109. Note that ON KEY...GOSUB excludes data input from the printer keypad. This example shows how the two unshifted keys F1 (ID 10) and F2 (ID 11) are used to change the printer contrast: 10 20 30 40 50 60 70 80 90 100 110 120 1000 1010 1020 2000 2010 2030 RUN PRPOS 100,500 PRLINE 100,100 FONT "Univers" PRPOS 100,300 MAG 4,4 PRTXT "SAMPLE" ON KEY (10) GOSUB 1000 ON KEY (11) GOSUB 2000 KEY (10) ON : KEY (11) ON GOTO 70 PRINTFEED END SETUP "MEDIA,CONTRAST,-10%" PRPOS 100,100 : PRTXT "Weak Print" RETURN 110 SETUP "MEDIA,CONTRAST,10%" PRPOS 100,100 : PRTXT "Dark Print" RETURN 110 Unconditional Branching Using a GOTO Statement The simplest type of unconditional branching is the waiting loop, which means that a program line branches the execution to itself and waits for something to happen, such as a keypress. This example shows how the program waits for the F1 key to be pressed (line 30). When the key is pressed, the printer beeps: 10 20 30 40 1000 1010 RUN ON KEY (10) GOSUB 1000 KEY (10) ON GOTO 30 END SOUND 880,100 END It is also possible to branch to a different line, as in this example: 10 INPUT "Enter a number: ", A% 20 IF A%