Keypad Library
The mikroC PRO for FT90x provides a library for working with 4x4 keypad. The library routines can also be used with 4x1, 4x2, or 4x3 keypad. For connections explanation see schematic at the bottom of this page.
External dependencies of Keypad Library
The following variable must be defined in all projects using Keypad Library: | Description : | Example : |
---|---|---|
extern sfr unsigned short keypadPort; |
Keypad Port. | unsigned short keypadPort at GPIO_PORT_48_55; |
Library Routines
Keypad_Init
Prototype |
void Keypad_Init(); |
---|---|
Description |
Initializes given port for working with keypad. |
Parameters |
None. |
Returns |
Nothing. |
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
// Keypad module connections unsigned short keypadPort at GPIO_PORT_48_55; // End Keypad module connections ... Keypad_Init(); // Initialize Keypad |
Notes |
None. |
Keypad_Key_Press
Prototype |
unsigned Keypad_Key_Press(); |
---|---|
Description |
Reads the key from keypad when key gets pressed. |
Parameters |
None. |
Returns |
The code of a pressed key (1..16). If no key is pressed, returns 0. |
Requires |
Port needs to be initialized for working with the Keypad library, see Keypad_Init. |
Example |
unsigned kp; ... kp = Keypad_Key_Press(); |
Notes |
None. |
Keypad_Key_Click
Prototype |
unsigned Keypad_Key_Click(); |
---|---|
Description |
Call to |
Parameters |
None. |
Returns |
The code of a clicked key (1..16). If no key is clicked, returns 0. |
Requires |
Port needs to be initialized for working with the Keypad library, see Keypad_Init. |
Example |
kp = Keypad_Key_Click(); |
Notes |
None. |
What do you think about this topic ? Send us feedback!