Difference between revisions of "Keypad"
(Created page with "category:Library_Reference =KEYPAD= ==KEYPAD_Init== {| class="wikitable" style="colspan:1; background-color:#4682B4;" {{#Widget:LibTable}} |- |Defination || |- | Inpu...") |
|||
| (15 intermediate revisions by 3 users not shown) | |||
| Line 2: | Line 2: | ||
=KEYPAD= | =KEYPAD= | ||
| + | |||
==KEYPAD_Init== | ==KEYPAD_Init== | ||
| − | {| | + | {|{{Widget:LibCol}} |
{{#Widget:LibTable}} | {{#Widget:LibTable}} | ||
|- | |- | ||
| − | |Defination || | + | |Defination || void KEYPAD_Init() |
|- | |- | ||
| − | | Input Arguments || | + | | Input Arguments || none |
|- | |- | ||
| − | | Return Value|| | + | | Return Value|| none |
|- | |- | ||
| − | | Description || | + | | 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 || | ||
|} | |} | ||
| Line 21: | Line 26: | ||
==KEYPAD_GetKey== | ==KEYPAD_GetKey== | ||
| − | {| | + | {|{{Widget:LibCol}} |
{{#Widget:LibTable}} | {{#Widget:LibTable}} | ||
|- | |- | ||
| − | |Defination || | + | |Defination || unsigned char KEYPAD_GetKey() |
|- | |- | ||
| − | | Input Arguments || | + | | Input Arguments || none |
|- | |- | ||
| − | | Return Value|| | + | | Return Value|| uint8_t: ASCII value of the Key Pressed |
|- | |- | ||
| − | | Description || | + | | Description || This function waits till a key is pressed and returns its ASCII Value. |
| + | |- | ||
| + | | Usage || | ||
|} | |} | ||
| + | ==Usage guide== | ||
| + | <syntaxhighlight> | ||
| + | #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; | ||
| + | } | ||
| − | + | </syntaxhighlight> | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
Latest revision as of 17:22, 28 December 2014
KEYPAD
KEYPAD_Init
| Defination | void KEYPAD_Init() |
| Input Arguments | none |
| Return Value | none |
| Description | This function configures the rows and columns for keypad scan.
|
| Usage |
KEYPAD_GetKey
| 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; }
