Keypad Library
mikroBasic 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 : |
---|---|---|
dim keypadPort_Input as byte sfr external |
Keypad Port. | dim keypadPort_Input as byte at GPIO_PORT_48_55 |
Library Routines
Keypad_Init
Prototype |
sub 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 |
' Keypad module connections dim keypadPort as byte at GPIO_PORT_48_55 ' End Keypad module connections ... Keypad_Init() ' Initialize Keypad |
Notes |
None. |
Keypad_Key_Press
Prototype |
sub function Keypad_Key_Press() as 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 |
dim kp as word ... kp = Keypad_Key_Press() |
Notes |
None. |
Keypad_Key_Click
Prototype |
sub function Keypad_Key_Click() as 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!