Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
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.
250
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
function Keypad_Key_Press(): byte;
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
var kp : byte;
...
kp := Keypad_Key_Press(); 
Prototype
function Keypad_Key_Click(): byte;
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
var kp : byte;
...
kp := Keypad_Key_Click();