Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 28th October 2009, 07:49 AM   #1
Default 4X4 keypad to pic

hi,
how to interface 4X4 keypad to pic-16f877?

plz help me.
thanks.
laxmid is offline  
Old 28th October 2009, 08:42 AM   #2
Default

Check my tutorials.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 28th October 2009, 01:01 PM   #3
Default

How to check your tutorials i mean where?


Please help me.
laxmid is offline  
Old 28th October 2009, 02:04 PM   #4
Default

Here
PIC Tutorial* Nine - HEX Keypad

- Raj
Experiments with PIC16F628A
rajbex is offline  
Old 29th October 2009, 08:30 AM   #5
Default

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
laxmid is offline  
Old 30th October 2009, 06:18 AM   #6
Default

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...
yohanevindra is offline  
Reply

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



All times are GMT. The time now is 01:13 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker