Datasheet
Keypad_Key_Press
Keypad_Key_Click
Library Example
This is a simple example of using the Keypad Library. It supports keypads with 1..4 rows and 1..4
columns. The code being returned by Keypad_Key_Click() function is in range from 1..16. In this
example, the code returned is transformed into ASCII codes [0..9,A..F] and displayed on LCD. In
addition, a small single-byte counter displays in the second LCD row number of key presses.
301
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
char Keypad_Key_Press(void);
Returns
The code of a pressed key (1..16).
If no key is pressed, returns 0.
Description Reads the key from keypad when key gets pressed.
Requires Port needs to be initialized for working with the Keypad library, see Keypad_Init.
Example
char kp;
...
kp = Keypad_Key_Press();
Prototype
char Keypad_Key_Click(void);
Returns
The code of a clicked key (1..16).
If no key is clicked, returns 0.
Description
Call to Keypad_Key_Click is a blocking call: the function waits until some key is
pressed and released. When released, the function returns 1 to 16, depending
on the key. If more than one key is pressed simultaneously the function will wait
until all pressed keys are released. After that the function will return the code of
the first pressed key.
Requires Port needs to be initialized for working with the Keypad library, see Keypad_Init.
Example
char kp;
...
kp = Keypad_Key_Click();