![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
hi, how to interface 4X4 keypad to pic-16f877? plz help me. thanks. | |
| |
| | #2 |
|
Check my tutorials.
| |
| |
| | #3 |
|
How to check your tutorials i mean where? Please help me. | |
| |
| | #4 |
| | |
| |
| | #5 |
|
i need to display keypad value on uart. please chk embedded c code. i wrote the code but its not working correctly plz chk the code given below: #define keyport PORTD //keypad connected to PORTD #define col1 RD0 //column 1 #define col2 RD1 //column 2 #define col3 RD2 //column 3 #define col4 RD3 //column 4 #define TRUE 1 //some defines #define FALSE 0 const unsigned char character_from_keypad[4][4]={ {'0','1','2','3'}, {'4','5','6','7'}, {'8','9','A','B'}, {'C','D','E','F'} }; void key_init() { TRISD=0x0F; //make Rows as o/p and cols are i/p keyport=0xFF; } unsigned char get_key() { unsigned char row,pressed_col,keypad_value=0; for(row=0;row<4;row++) //loop for 4 rows { keyport &= ~(0x80>>row); //to make rows low 1 by 1 if(!col1) //check if col1 is pressed { while(!col1) { continue; } DelayMs(50); //wait for release pressed_col= col1; //set key number keypad_value=character_from_keypad[row][pressed_col];// to read the value from keypad return keypad_value; //return key number } else if(!col2) //check if col2 is pressed { while(!col2) { continue; } DelayMs(50); //wait for release pressed_col=col2; //set key number keypad_value=character_from_keypad[row][pressed_col]; return keypad_value; //return key number } else if(!col3) //check if col3 is pressed { while(!col3) { continue; } DelayMs(50); //wait for release pressed_col=col3; //set key number keypad_value=character_from_keypad[row][pressed_col]; return keypad_value; //return key number } else if(!col4) //check if key4 is pressed { while(!col4) { continue; } DelayMs(50); //wait for release pressed_col=col4; //set key number keypad_value=character_from_keypad[row][pressed_col]; return keypad_value; //return key number } else { //pressed_col+=4; //next row key number keyport |= 0x80>>row; //make the row high again } } return FALSE; //return false if no key pressed } void main() { unsigned char keypad_input; init_comms(); key_init(); while(1) { keypad_input=get_key(); putch(keypad_input); } thanks | |
| |
| | #6 |
|
use the MM74C922N keypad encoder. its makes it so much easier, because by configuring the debounce and scan time periods you dont have to bother about them. all tht you hav to do is read the data from the IC...
| |
| |
|
| Tags |
| 4x4, keypad, pic |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Dragonfly 16F877A PIC Tutor with LCD & 4x4 keypad. Comments? | William At MyBlueRoom | Micro Controllers | 7 | 9th August 2009 11:16 AM |
| code problems for 4x4 keypad | darsin | General Electronics Chat | 27 | 16th July 2008 07:20 AM |
| How does 4x4 keypad work? | janetsmith2000@yahoo.com | Micro Controllers | 4 | 17th July 2005 08:02 PM |
| 4x4 Keypad | sidd81 | Electronic Projects Design/Ideas/Reviews | 3 | 30th March 2004 05:25 AM |
| 4X4 KEYPAD TO 16 RELAYS HELP! | egg0900 | Electronic Projects Design/Ideas/Reviews | 12 | 23rd February 2004 06:07 PM |