Remote-processing RPC-2300 Manuel d'utilisateur Page 28

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 36
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 27
KEYPAD PORT CHAPTER 9
Page 26 RPC-2300
Figure 9-1 Keypad connector
INTRODUCTION
16 position keypads are plugged into keypad port J5.
Keys are arranged in a 4 x 4 matrix format. A key is
recognized when a row and a colum n connect.
CAM BASIC II automatically scans and debounces the
keypad every debounce time. Debounce time is fixed at
80 ms. Keypad presses m ay be return ed either as a
number from 1 to 16 or as an ASCII character. The
ASCII character returned corresponds to those on
Remote Processing's KP-1 keypad. Character
assignments are changed using the SYS(8) function.
Keypads from Remote Processing simply plug into J5.
Keypad cable length should be limited to less than 5 feet.
If the keypad port is not used, it may be used as a
general purpose digital I/O port.
PROGRAMMING EXAMPLE
The following example sets up CAMBASIC II to scan a
16 position keypad. The results are echo' ed to the
display and the speaker is sounded when a key is
pressed.
10 CONFIG PIO 1,0,1,1,0,64
20 'Optionally change keypad character 'B'
30 ' to the letter 'M'
40 POKE SYS(8)+7,77
60 ON KEYPAD$ GOSUB 500
70 PRINT " Enter a number";
100 'loop for this example
110 GOTO 100
500 A$ = KEYPAD$(0)
510 IF A$ = "C" THEN ..clear_beep
520 IF A$ = CHR$(13) THEN ..enter
530 PRINT A$;
540 B$ = B$+A$
560 RETURN
600 ..clear_beep
610 B$=""
630 DELAY .4
650 PRINT CHR$(12); " ";CHR$(12);
660 RETURN
700 ..enter
710 FL = 1
730 RETURN
Program explanation
Lines 10-80 set up the parameters for the keypad.
Lines 500 to 730 process the key press. If a "C " or "#"
is pressed, it is an exception and is handled that way.
Otherwise, the character is displayed and stored.
Lines 700 to 730 process the "enter" key. The enter
flag, FL , is set to a 1 to indicate to another part of the
program that B$ has complete data.
The KEYPAD$(0) function returns a single character
string that has been assigned to a particular key.
Characters ar e assigned usin g the SYS(8 ) statemen t.
KEYPAD PORT PI N OUT - J5
The keypad port uses port C from an 82C55. Lower
port C is configured as an input. Upper port C are
outputs.
The table below lists J5' s pin out, 82C55 port and bit,
and its intended function.
Pin 82C55 Function
Port/ bit
1 C/0 Row 1
2 C/6 Column 3
3 C/5 Column 2
4 C/1 Row 2
5 C/2 Row 3
6 C/4 Column 1
7 C/7 Column 4
8 C/3 Row 4
9 nc
10 Ground
Vue de la page 27
1 2 ... 23 24 25 26 27 28 29 30 31 32 33 34 35 36

Commentaires sur ces manuels

Pas de commentaire