Datasheet
Ps2_Key_Read
368
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
unsigned short Ps2_Key_Read(unsigned short *value, unsigned short
*special, unsigned short *pressed);
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,
punctuation 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.
- 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
unsigned short value, special, pressed;
...
// Press Enter to continue:
do {
if (Ps2_Key_Read(&value, &special, &pressed)) {
if ((value == 13) && (special == 1)) break;
}
} while (1);