
CHAPTER 9 KEYPAD PORT
9-1
Figure 9-1 J5 keypad connector location
CHAPTER SYNOPSIS
Operating information
Multiple use note
DESCRIPTION
KEYPAD PORT CHAPTER 9
16 position keypads are plugged into keypad port J5.
Keys are arr anged in a 4 x 4 to 6 x 4 matr ix format. A
key is recognized when a row and a column connect.
Up to 24 keys can be scanned.
CAMBASIC scans and debounces the keypad every
debounce time. Debounce time is fixed at 40 ms. A key
is debounced when it is down for two scans (80 ms).
Keypad presses may be returned either as a num ber from
1 to 16 (1-24 in 24 position scan mode)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 5 feet.
If the keypad port is not used, it may be used as a
general purpose digital I/O port.
When 24 keys are scanned, U19 port B bits 0 and 1 are
used for scanning. These lines also go to the high
current buffer U20, and on to J3, pins 8 and 10. If you
are using the high current port also, do not use these two
lines.
PROGRAMMING THE KEYPAD
Sixteen and 24 position keypads use all of port C at U19.
The 24 position keypad use and additional 2 lines from
port B. Port B drives the high current sink, U20. If you
are using the high current dr iver, or have replaced it
with a DIP shunt jumper, lines at J3-8 and J3-10 are not
usable with a 24 position keypad only.
U19 (keypad port IC) must be configured using the
CON FIG PIO command. Some ports are optional,
depending upon what you want to connect to it. Use the
table below to help determine what a port should be
(input or output) when using a keypad.
Port Function Configuration
A LCD character driver
General purpose TTL I/O
Output
Output or input
B High current sink
When using 24 keypad
Use 16 position keypad or
general purpose TTL I/O
Output
Output
Output or input
LC Keypad row (inputs) Input
UC Keypad column Output
Check the table above to determine what you will be
using. The Configuration column describes what that
port should be set to.
The ON KEYPA D$ multitasking statement initializes the
operating system to use the keypad. It tells the system
what size of keypad to scan and what line to execute on a
key press. W hen this command is executed, the
scanning process begins.
INPUT KEYP AD$ allow you to input data from the
keypad and echo the data to an LCD character or
graphics display. Input can be a string or floating point
number. Refer to INPU T KEYP AD$ com mand in the
CAMBASIC manual. Use 8 for echo port. Only smaller
characters can be echoed back to the display.
The KEYPAD$(n) function returns either the keypad
character (as an ASCII value) or its position. When
getting a character, keep in mind the difference between
an ASCII value vs real. An ASCII ‘1' is not the same as
the number 1 used for calculations.
Kommentare zu diesen Handbüchern