Continue to Site

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.

Fundamentlas of Microcontroller

Status
Not open for further replies.

Elec. Engineer

Newbie level 5
Joined
May 1, 2010
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
UAE
Activity points
1,376
Hello ..
How r u all ?
i'm an electronic engineering student ..

i ahve a question regarding the Keil assembly ..
i'm doning a lab ,, i just finish doing it .. i need help to write a report ..
its about interfacing to a keypad, which includes these part: a keypad scanning routine, a code conversion routine and creating include file ..

so, anyone could help .?
much appreciated :)
 

1.Make four pin as input and four pin as output.
2. put a high voltage at first input pin .
3.Scan all the out put pin, which pin is high
4.pass the high voltage in to another input pin
5.scan the output pins
6.rtepeat the same procedure.
 

There is another methode which depends on the number of keys you want to scan:
Use one channel of ADC and read the voltages: this frees lots of pin ports.
 

Hai,
Here i post a program for 4*3 keypad with LCD display make necessary changes.

unsigned short kp, cnt, oldstate = 0;
char txt[5];

void main()
{
cnt = 0;
trisc=0x00;
trisb=0xf0;
Lcd8_Config(&portc,&portd,1,3,2,7,6,5,4,3,2,1,0);
Lcd8_Cmd(LCD_CLEAR); // Clear display
Lcd8_Cmd(LCD_CURSOR_OFF); // Cursor off
Lcd8_Out(1,1,"start");

while(1)
{
portb=0x01;
while(portb.f4==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"1");
}
while(portb.f5==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"5");
}
while(portb.f6==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"9");

}
while(portb.f7==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"menue");
}





portb=0x02;
while(portb.f4==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"2");
}
while(portb.f5==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"6");
}
while(portb.f6==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"0");

}
while(portb.f7==1)
{
// Lcd8_Cmd(lcd_clear);
Lcd8_Out_CP("rst");
}


portb=0x04;
while(portb.f4==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"3");
}
while(portb.f5==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"7");
}
while(portb.f6==1)
{
Lcd8_Cmd(lcd_clear);
Lcd8_Out(1,1,"A");

}
while(portb.f7==1)
{
// Lcd8_Cmd(lcd_clear);
Lcd8_Out_CP("B");
}
/* wirte rest code*/
}
}
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top