Remote-processing CAMBASIC Manual de usuario Pagina 199

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 208
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 198
Event Multitasking - 10
Line 80 returns program execution to the place that it was executing before the key was pressed.
Inputting Multi– digit Numbers
The basic examples print out the key that was pressed. The following example is a variation of the basic 16 key demo
that inputs a multi– digit number.
10 'Input a multi–digit number
30 ON KEYPAD$ GOSUB ..Key_interrupt
35 PRINT R
40 DELAY .25
45 GOTO 35
50 ..Key_interrupt
55 B$=KEYPAD$(0)
60 IF B$=CHR$(13) THEN ..Get_value
65 IF B$="*" THEN B$="."
70 A$=A$+B$
75 RETURN
80 ..Get_value
85 R=VAL(A$)
90 A$=""
95 RETURN
Line 30 tells CAMBASIC to call a subroutine by the name of “Keypad_interrupt” every time a key
is pressed.
Line 35 prints the number that the input string will be converted to. Initially, it will be zero.
Line 40 is a 0.25 second delay for demonstration pur poses.
Line 45 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 55 assigns the input to B$.
Line 60 tests to see if this is the term inator key for the input.
Line 65 tests to see if the input is an asterisk. If so, it converts it to a decimal point.
Line 70 adds the new value to the string.
Line 75 returns program execution to the place that it was executing before the key was pressed.
Line 85 converts the assembled string into a number.
Line 90 clear the assembled string to a null string.
Line 95 returns program execution to the place that it was executing before the key was pressed.
Fast Branching on Keys
Sometimes the input data is in the form of symbols. That is, rather than numbers and letters, the keypads legends might be
direction arrows or words like “Load” and “Stop”.
Vista de pagina 198
1 2 ... 194 195 196 197 198 199 200 201 202 203 204 ... 207 208

Comentarios a estos manuales

Sin comentarios