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.

Keypad scaning problem.

Status
Not open for further replies.

HerohetoChakma

Junior Member level 3
Joined
Apr 19, 2013
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Chittagong, Bangladesh.
Activity points
2,338
I have create a program by which i can set two digit desire set point by using 4*3 Membrame keypad that will show in LCD display. But when i simulate my program in protious it is work by trying more times. Sometimes it dosn't work. But every key is ok. I means sometimes they are ok. Sometimes i can set only one digit number. When i simulate my program an error message is show that simulation can't run due to excessive load. My code are given bellow. How can i solve this problem? Could anybody help me please?????????????
// Keypad scanning functions
//=============================================================================
void clearrow1(void) //clear the 1st row and set the others
{
RC7=0;
RC6=1;
RC5=1;
RC4=1;
}
void clearrow2(void) //clear the 2nd row and set the others
{
RC7=1;
RC6=0;
RC5=1;
RC4=1;
}
void clearrow3(void) //clear the 3rd row and set the others
{
RC7=1;
RC6=1;
RC5=0;
RC4=1;
}
void clearrow4(void) //clear the 4th roW and set the others
{
RC7=1;
RC6=1;
RC5=1;
RC4=0;
}
void scancolumn1(void)
{
if(RC0==0) //if key '1' is being pressed
{
while(RC0==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st word
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of nuum_count //variable
send_char('1'); //Display the symbol '1' at LCD
keyin[num_count]='1'; //Stall the '1' value at the keyin array
num_count+=1; //increase the num_count variable's value by 1 //and the result stall back to the variable
}
else if(RC1==0) //if key '2' is being pressed
{
while(RC1==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('2'); //Display the symbol '2' at LCD
keyin[num_count]='2'; //Stall the '2' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
else if(RC2==0) //if key '3' is being pressed
{
while(RC2==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('3'); //Display the symbol '3' at LCD
keyin[num_count]='3'; //Stall the '3' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
}
void scancolumn2(void)
{
if(RC0==0) //if key '4' is being pressed
{
while(RC0==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('4'); //Display the symbol '4' at LCD
keyin[num_count]='4'; //Stall the '4' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
else if(RC1==0) //if key '5' is being pressed
{
while(RC1==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('5'); //Display the symbol '5' at LCD
keyin[num_count]='5'; //Stall the '5' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
else if(RC2==0) //if key '6' is being pressed
{
while(RC2==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('6'); //Display the symbol '6' at LCD
keyin[num_count]='6'; //Stall the '6' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
}
void scancolumn3(void)
{
if(RC0==0) //if key '7' is being pressed
{
while(RC0==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('7'); //Display the symbol '7' at LCD
keyin[num_count]='7'; //Stall the '7' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
else if(RC1==0) //if key '8' is being pressed
{
while(RC1==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('8'); //Display the symbol '8' at LCD
keyin[num_count]='8'; //Stall the '8' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
else if(RC2==0) //if key '9' is being pressed
{
while(RC2==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('9'); //Display the symbol '9' at LCD
keyin[num_count]='9'; //Stall the '9' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
}
void scancolumn4(void)
{
if(RC0==0) //if key '*' is being pressed
{
while(RC0==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('*'); //Display the symbol '*' at LCD
keyin[num_count]='*'; //Stall the '*' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
else if(RC1==0) //if key '0' is being pressed
{
while(RC1==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('0'); //Display the symbol '0' at LCD
keyin[num_count]='0'; //Stall the '0' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
else if(RC2==0) //if key '#' is being pressed
{
while(RC2==0)continue; //waiting the key to be released
if(num_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(num_count); //The cursor of LCD points to the column //equivalent to the value of password_count //variable
send_char('#'); //Display the symbol '#' at LCD
keyin[num_count]='#'; //Stall the '#' value at the keyin_char array
num_count+=1; //increase the Password_count variable's value //by 1 and the result stall back to the variable
}
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top