Code C - [expand] 1 lcd_cmd(12);
Does this mikroC Code really Compile? I don't think so.
This will give error. See help file on using LCD_Cmd() function.
Code C - [expand] 1 lcd_cmd(12);
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 void init() { adcon1=7; cmcon = 0x07; trisa = 0xff; trisb = 0x00; trisd = 0xff; porta = 0x00; portb = 0x00; portc = 0x00; portc=0; trisc=0; lcd_init(); lcd_cmd(12); keypad_init(); } void startup() { portc=0b11111111; delay_ms(100); portc=0b00000000; delay_ms(100); lcd_out(1,1,"welcome"); delay_ms(200); lcd_cmd(1); ptr=&fromuser; } while(1) { kp = 0; while(kp != 4) { do kp = Keypad_Key_Click(); while (!kp); } kp = 0; while(i < pwdLen) { do kp = Keypad_Key_Click(); while (!kp); switch(kp) { case 1:key_value=7;break; case 2:key_value=4;break; case 3:key_value=1;break; case 4:key_value=30;break; case 5:key_value=8;break; case 6:key_value=5;break; case 7:key_value=2;break; case 8:key_value=0;break; case 9:key_value=9;break; case 10:key_value=6;break; case 11:key_value=3;break; } userPwd[i] = key_value; lcd_chr(1,1+i,'*'); ++i; } Delay_ms(2000); i = 0; while(i < pwdLen) { if(userPwd[i] == password[i]) matchCounter++; ++i; } if(matchCounter == pwdLen) { //PWD matches } else { //Wrong PWD } }
It works fine. You have to press ON key and KP unlocks. Then it asks to enter password. Your password is 1234. If 1234 is entered then it shows Password OK message. It shows Wrong Password message on the detection of 1st unmatched password character during password entering process itself that is if you enter 16 then as soon as you enter 6 it shows Wrong Password message. It doesn't wait for you to enter all characters of password to test if it matches with stored password.
Code:do kp = Keypad_Key_Click(); while (!kp);
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?