Keypad Library
mikroPascal 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 : |
---|---|---|
var keypadPort : byte; sfr; external; |
Keypad Port. | var keypadPort : byte at GPIO_PORT_48_55; |
Library Routines
Keypad_Init
Prototype |
procedure 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 |
GPIO_PORT_48_55// Keypad module connections var keypadPort : byte at GPIO_PORT_48_55; // End Keypad module connections ... Keypad_Init(); // Initialize Keypad |
Notes |
None. |
Keypad_Key_Press
Prototype |
function Keypad_Key_Press(): word; |
---|---|
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 |
var kp : word; ... kp := Keypad_Key_Press(); |
Notes |
None. |
Keypad_Key_Click
Prototype |
function Keypad_Key_Click(): word; |
---|---|
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!