Ejemplo n.º 1
0
/***************************************************KEYPAD *****************************************
 				Displays keys pressed on 4x4 keypad on the uart
*****************************************************TEST*******************************************/
void keypad_test()
{
uint8_t key;
UART_Printf("\n\rConnections: Port 2");
UART_Printf("\n\rMake connections and hit 'k' to test!");
while(UART_RxChar()!='k');
KEYPAD_Init();
while(1)
{
  key = KEYPAD_GetKey();
  UART_Printf("\n\r Key:%c", key);
}
}
Ejemplo n.º 2
0
int main() 
{
    uint8_t key;
	SystemInit();
    UART0_Init(9600);                                     // Initialize UART0 at 9600 baud rate
    KEYPAD_Init(P2_0,P2_1,P2_2,P2_3,P2_4,P2_5,P2_6,P2_7); // Keypad is connected to P2_0 - P2_7

    while (1) 
    {
        key = KEYPAD_GetKey();                            // Read the Ascii value of Key
        UART0_Printf("\n\r Key:%c", key);                 // Transmit the key pressed on UART
    }                      
}
/***************************************************KEYPAD *****************************************
 				Displays keys pressed on 4x4 keypad on the uart
*****************************************************TEST*******************************************/
void keypad_test()
{
uint8_t key;
UART_Printf("\n\rConnections: PORTD");
UART_Printf("\n\rMake connections and hit 'k' to test!");
while(UART_RxChar()!='k');
KEYPAD_Init(PD_0,PD_1,PD_2,PD_3,PD_4,PD_5,PD_6,PD_7);
while(1)
{
  key = KEYPAD_GetKey();
  UART_Printf("\n\r Key:%c", key);
}
}
Ejemplo n.º 4
0
/* Program to demonstrate the hex-Keypad interface*/
int  main()
{
  uint8_t key;
  LCD_Init(8,2,16);            /*Initialize the 2x16 LCD in 8-bit mode */
  KEYPAD_Init();               /*Configure the ROWs and COLUMNs for keypad scanning*/

	while(1)
	{
		key = KEYPAD_GetKey(); /*Get the Ascii value of the key Pressed */
		LCD_DisplayChar(key);  /*Display the key pressed */
	}

	return 0;
}