Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

interfacing keypad with 89c52

Status
Not open for further replies.

misha82

Member level 2
Joined
Jun 6, 2005
Messages
45
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,641
hi
can anybody give me an idea how to interface a keypad with 4 keys with a microcontroller 89c51?
thanx
 

silvio

Advanced Member level 3
Joined
Dec 31, 2001
Messages
715
Helped
105
Reputation
210
Reaction score
16
Trophy points
1,298
Location
Romania
Activity points
11,468
Sooner or later you'll need more than 4.
Watch these slides:
**broken link removed**
 

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
i use 89s52 but the principle is same :) maybe is not the best variant but work !

while(1)
{
Sw_State = Switch_Get_Input(10);
Display_Switch_Update(Sw_State);
}
.....................................
char Switch_Get_Input(const unsigned char debounce_period)
{
char Return_value = 0x00;
if(Switch_Pin_1 == 0)
{
delay_ms(debounce_period);
if(Switch_Pin_1 == 0)
{
while(Switch_Pin_1 == 0);
Return_value = 0x01;
}
}
if(Switch_Pin_2 == 0)
{
delay_ms(debounce_period);
if(Switch_Pin_2 == 0)
{
while(Switch_Pin_2 == 0);
Return_value = 0x02;
}
}
if(Switch_Pin_3 == 0)
{
delay_ms(debounce_period);
if(Switch_Pin_3 == 0)
{
while(Switch_Pin_3 == 0);
Return_value = 0x03;
}
}
if(Switch_Pin_4 == 0)
{
delay_ms(debounce_period);
if(Switch_Pin_4 == 0)
{
while(Switch_Pin_4 == 0);
Return_value = 0x04;
}
}
return Return_value;
}
---------------------------------------------------------------
void Display_Switch_Update(const char SWITCH_STATUS)
{
switch (SWITCH_STATUS){
case 0x01 :
Some command;
break;
case 0x02 :
Some command;
break;
case 0x03 :
Some command;
break;
case 0x04 :
Some command;
break;
default:
Some command;
break;
}
}

..::SyRaX:..
 

casamiro

Member level 1
Joined
Jan 3, 2010
Messages
34
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Pakistan
Activity points
1,465
HI All

Plz help me i m new in micro controller.i m using 89s51 mc and want to make a keypad lock using it. so plz help me out.


casamiro
 

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
simple way:

make variable enabled

and then :
if(enabled){
get_key();
}

if you wanna lock keys just make enabled = 0
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top