mikroC

making it simple...

Keypad Library

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC provides library for working with 4x4 keypad; routines can also be used with 4x1, 4x2, or 4x3 keypad. Check the connection scheme at the end of the topic.

Library Routines

Keypad_Init

Keypad_Read

Keypad_Released

Keypad_Init

Prototype

void Keypad_Init(char *port);

Description Initializes port to work with keypad. The function needs to be called before using other routines of the Keypad library.

Example Keypad_Init(&PORTB);

Keypad_Read

Prototype

unsigned Keypad_Read(void);

 

 

Returns

1..16, depending on the key pressed, or 0 if no key is pressed.

 

 

Description

Checks if any key is pressed. Function returns 1 to 16, depending on the key pressed, or

 

0 if no key is pressed.

 

 

Requires

Port needs to be appropriately initialized; see Keypad_Init.

 

 

Example

kp = Keypad_Read();

 

 

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

193