hemnath
Advanced Member level 3
- Joined
- Jun 24, 2012
- Messages
- 702
- Helped
- 61
- Reputation
- 120
- Reaction score
- 57
- Trophy points
- 1,308
- Location
- Chennai
- Activity points
- 6,589
Hi,
I'm interfacing matrix keypad with pic 18F4520. 4Mhz internal oscillator, Compiler: CCS.
I have entered the password 1234. But it doesn't display "correct password" on LCD. Why is it?
I'm interfacing matrix keypad with pic 18F4520. 4Mhz internal oscillator, Compiler: CCS.
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 #include "18F4520.h" #fuses XT #use delay(clock = 4000000) #include "flex_lcd.c" #include "flex_kbd.c" #include "kbd_buffer.c" #include "string.h" #define MAX_PASSWORD_SIZE 8 //================================== void main() { int8 password_array[MAX_PASSWORD_SIZE +1]; lcd_init(); kbd_init(); kbd_buffer_init(); while(1) { lcd_putc("\fEnter Password:\n"); // Get the password from keypad input by the user. The password // can be from 1 to 8 digits. // The user must press '#' key to exit the password entry screen. // The user can press '*' key to backspace over chars. kbd_get_string(password_array, MAX_PASSWORD_SIZE); // Display the password that we just got. lcd_putc("\fPassword is:\n"); printf(lcd_putc, "%s", password_array); delay_ms(3000); if(password_array == 1234) { lcd_putc("\fCorrect Password\n"); } } }
I have entered the password 1234. But it doesn't display "correct password" on LCD. Why is it?
Last edited by a moderator: