(9 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
=KEYPAD=
 
=KEYPAD=
 +
  
  
 
==KEYPAD_Init==
 
==KEYPAD_Init==
{| class="wikitable"  style="colspan:1; background-color:#4682B4;"
+
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
Line 14: Line 15:
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
| Description || This function configures the rows and columns for keypad scan.   1.ROW lines are configured as Output. 2.Column Lines are configured as Input.             
+
| Description || This function configures the rows and columns for keypad scan.<br />
 +
*ROW lines are configured as Output.<br />
 +
*Column Lines are configured as Input.             
 
|-
 
|-
 
| Usage ||
 
| Usage ||
 
|}
 
|}
 +
 +
 +
  
 
==KEYPAD_GetKey==
 
==KEYPAD_GetKey==
{| class="wikitable"  style="colspan:1; background-color:#4682B4;"
+
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
Line 27: Line 33:
 
| Input Arguments || none
 
| Input Arguments || none
 
|-
 
|-
| Return Value|| uint8_t--> ASCII value of the Key Pressed
+
| Return Value|| uint8_t: ASCII value of the Key Pressed
 
|-
 
|-
| Description ||  This function waits till a key is pressed and returns its ASCII Value. It follows the following sequences to decode the key pressed:
+
| Description ||  This function waits till a key is pressed and returns its ASCII Value.
1.Wait till the previous key is released..
+
2.Wait for the new key press.
+
3.Scan all the rows one at a time for the pressed key.
+
4.Decodes the key pressed depending on ROW-COL combination and returns its
+
  ASCII value.
+
 
|-
 
|-
 
| Usage ||
 
| Usage ||
 
|}
 
|}
  
==KEYPAD_WaitForKeyRelease==
+
==Usage guide==
{| class="wikitable" style="colspan:1; background-color:#4682B4;"
+
<syntaxhighlight>
{{#Widget:LibTable}}
+
#include"keypad.h"
|-
+
#include"lcd.h"
|Defination || void KEYPAD_WaitForKeyRelease()
+
#include "delay.h" 
|-
+
| Input Arguments || none
+
|-
+
| Return Value|| none
+
|-
+
| Description ||  This function waits till the previous key is released.
+
|-
+
| Usage ||
+
|}
+
  
==KEYPAD_WaitForKeyPress==
+
 
{| class="wikitable"  style="colspan:1; background-color:#4682B4;"
+
/* Program to demonstrate the hex-Keypad interface*/
{{#Widget:LibTable}}
+
int  main()
|-
+
{
|Defination ||  '''void KEYPAD_WaitForKeyPress()'''
+
  uint8_t key;
|-
+
  LCD_Init(8,2,16);            /*Initialize the 2x16 LCD in 8-bit mode */
| Input Arguments || none
+
  KEYPAD_Init();              /*Configure the ROWs and COLUMNs for keypad scanning*/
|-
+
 
| Return Value|| none
+
while(1)
|-
+
{
| Description || This function waits till a new key is pressed. The new Key pressed can be decoded by the function KEYPAD_GetKey.
+
key = KEYPAD_GetKey(); /*Get the Ascii value of the key Pressed */
|-
+
LCD_DisplayChar(key); /*Display the key pressed */
| Usage ||
+
}
|}
+
 
 +
return 0;
 +
}
 +
 
 +
</syntaxhighlight>

Latest revision as of 17:22, 28 December 2014


KEYPAD

KEYPAD_Init

{{#Widget:LibTable}}
Defination void KEYPAD_Init()
Input Arguments none
Return Value none
Description This function configures the rows and columns for keypad scan.
  • ROW lines are configured as Output.
  • Column Lines are configured as Input.
Usage



KEYPAD_GetKey

{{#Widget:LibTable}}
Defination unsigned char KEYPAD_GetKey()
Input Arguments none
Return Value uint8_t: ASCII value of the Key Pressed
Description This function waits till a key is pressed and returns its ASCII Value.
Usage

Usage guide

#include"keypad.h"
#include"lcd.h"
#include "delay.h"   
 
 
/* 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;
}