Specifications
Event Multitasking - 11
250 RETURN
and so forth.
Line 40 tells CAMBASIC to call a subroutine by the name of “Keypad_interrupt” every time a key is
pressed.
Line 50 is used only as part of this demo program so that the system will wait. You could insert the
rest of your control program.
Line 70 assigns the input position to variable K.
Line 90 returns program execution to the place that was executing before the key was pressed.
However, the program should never get to this point if 16 line numbers are specified.
Line 100 would be the routine to handle the operation desired by pressing key 1.
Line 150 returns program execution to the place that it was executing before the key was pressed.
Line 200 would be the routine to handle the operation desired by pressing key 1.
Line 250 returns program execution to the place that it was executing before the key was pressed.
Using INPUT KEYPAD$
The previous examples have shown how to use a keypad on an interrupt basis. In some applications it is acceptable for the
program to wait for operator input. INPUT KEYPAD$ will accept data in the same manner as the INPUT statement does
from a serial port.
The following example is for the KP–1 keypad. It uses the default assignment of a carriage return (13) for the "#" key.
This is necessary, as a string input must be terminated with the carriage return.
30 INPUT KEYPAD$ 1,A$
40 PRINT A$
Line 30 is the input statement. The parameter “1” tells the system to echo the keypad characters to
the COM1 serial port. In an actual application, the characters would probably be echoed to a
multiline display. Enter the data and then press the "#" key.
Line 40 will print out the string.