KP1-4X4 Matrix Keypad


A 4 by 4 matrix keypad ( KP1-4X4 ) scanning example. This example uses the Scan4x4Keypad() function from BiPOM Library. When a key is pressed, the key value is printed to terminal and to LCD display.

Toolkit:ARM Development System

Location:/bipom/devtools/GCC/LPC2000/examples/Keypad4x4

Code Example


int main (void)
{
	char keyCode;
	/* Initialize the system */
	Initialize();
	/* Send messages to TERMINAL window */
	tiprintf("\n\rBIPOM MINI-MAX/ARM");
	tiprintf("\n\rKEYPAD TEST ");
	/* Initialize 4-bit LCD interface */
	InitializeLCD();	
	for (;;)
	{
		keyCode = Scan4x4Keypad();
		if (keyCode)
		{
			tiprintf("\n\rKey: %c",keyCode);
			if (keyCode == '#')
			{
				tiprintf(" Clear LCD Display");	
				ClearLCD();
				continue;
			}
			lcd_printf("%c",keyCode);
		}
	}
}