ABL electronic PIC18 Benutzerhandbuch

Seite von 312
mikroC provides library for working with 4x4 keypad; routines can also be used
with 4x1, 4x2, or 4x3 keypad. Check the connection scheme at the end of the
topic.
Keypad_Init
Keypad_Read
Keypad_Released
MikroElektronika:  Development  tools  -  Books  -  Compilers
193
page
mikroC - C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
Keypad Library
Library Routines
Prototype
void 
Keypad_Init(char *port);
Description
Initializes 
port
to work with keypad. The function needs to be called before using other
routines of the Keypad library.
Example
Keypad_Init(&PORTB);
Keypad_Init
Prototype
unsigned 
Keypad_Read(void);
Returns
1..16, depending on the key pressed, or 0 if no key is pressed.
Description
Checks if any key is pressed. Function returns 1 to 16, depending on the key pressed, or
0 if no key is pressed.
Requires
Port needs to be appropriately initialized; see 
Keypad_Init
.
Example
kp = Keypad_Read();
Keypad_Read