- CODE: SELECT_ALL_CODE
void scancolumn2(void)
{
if(RA0==0) //if key '4' is being pressed
{
while(RA0==0)continue; //waiting the key to be released
if(password_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(password_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_char[password_count]='4'; //Stall the '4' value at the keyin_char array
password_count+=1; //increase the Password_count variable's value by 1 and the result stall back to the variable
}
else if(RA1==0) //if key '5' is being pressed
{
while(RA1==0)continue; //waiting the key to be released
if(password_count==0)lcd_clr(); //Clear the LCD if the key is the 1st password
lcd_goto(password_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_char[password_count]='5'; //Stall the '5' value at the keyin_char array
password_count+=1; //increase the Password_count variable's value by 1 and the result stall back to the variable
}
Put the code :send_char('*');
after the code : keyin_char[password_count]='4';
as code : send_char('4');
Modify the rest of the code from ('*') to the corresponding numbers.
In this way when you keyin the password, you can see what numbers you've just entered. Then you can tell if your keypad is working properly. If you get '123456' and the message is still "FAIL", well, either the password in the program has been changed or your program is corrupted.
Allen