mikroC

mikroC - C Compiler for Microchip PIC microcontrollers

making it simple...

Ps2_Key_Read

Prototype

char Ps2_Key_Read(char *value, char *special, char *pressed);

 

 

Returns

Returns 1 if reading of a key from the keyboard was successful, otherwise 0.

 

 

Description

The function retrieves information about key pressed.

 

Parameter value holds the value of the key pressed. For characters, numerals, punctua-

 

tion marks, and space, value will store the appropriate ASCII value. Routine “recog-

 

nizes” the function of Shift and Caps Lock, and behaves appropriately.

 

Parameter 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.

 

Parameter pressed is set to 1 if the key is pressed, and 0 if released.

 

 

Requires

PS/2 keyboard needs to be initialized; see Ps2_Init or Ps2_Config.

 

 

Example

// Press Enter to continue:

 

do {

 

if (Ps2_Key_Read(&value, &special, &pressed)) {

 

if ((value == 13) && (special == 1)) break;

 

}

 

} while (1);

 

 

page

 

238

MikroElektronika: Development tools - Books - Compilers