Mikroelektronika MIKROE-350 Datenbogen
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
Ps2_Key_Read
304
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function Ps2_Key_Read(dim byref value as byte, dim byref spe-
cial
cial
as byte, dim byref pressed as byte) as byte
Returns
-
1
if reading of a key from the keyboard was successful
-
0
if no key was pressed
Description
The function retrieves information on key pressed.
Parameters :
-
value:
holds the value of the key pressed. For characters, numerals, punctu-
ation marks, and space value will store the appropriate ASCII code. Routine
“recognizes” the function of Shift and Caps Lock, and behaves appropriately.
For special function keys see Special Function Keys Table.
-
“recognizes” the function of Shift and Caps Lock, and behaves appropriately.
For special function keys see Special Function Keys Table.
-
special:
is a flag for special function keys (F1, Enter, Esc, etc). If key
pressed is one of these,
special
will be set to 1, otherwise 0.
-
pressed:
is set to 1 if the key is pressed, and 0 if it is released.
Requires
PS/2 keyboard needs to be initialized. See Ps2_Config routine.
Example
dim value, special, pressed as byte
...
do {
...
do {
if (Ps2_Key_Read(value, special, pressed)) then
if ((value = 13) and (special = 1)) then
break
end if
end if
loop until (0=1)