![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Guest
|
Help plz in this project !! |
Posted: Sun Feb 08, 2009 7:49 am |
|
|
Hi everybody
I used the examples for LCD+KBD to do door lock project using PIC16F877!
My question is .. how can I store a default PIN code in EEPROM and compare it with the pressed key ?! Anyone can suggest or give me a code for it ??
this is my code >>
Code: |
#if defined(__PCB__)
#include <16C56.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=2000000)
#elif defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=2000000)
#elif defined(__PCH__)
#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=2000000)
#endif
#include <lcd.c>
#include <kbd.c>
void main(void) {
char k;
port_b_pullups(TRUE);
lcd_init();
kbd_init();
lcd_putc("\fM.DOOR (FLAT1)\n");
delay_ms(500);
lcd_putc("PIN : ");
delay_ms(500);
while (TRUE) {
k=kbd_getc();
if(k!=0)
if(k=='*')
lcd_putc('\f');
else
lcd_putc(k);
}
} |
|
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Sun Feb 08, 2009 10:45 am |
|
|
Start small, get working code and then add features.
Get your program to just recognize and repeat the pin code.
Then, get your program to work with just figuring out how to compare strings (your PIN to what is entered).
Use something like,
const char pin_code[6]={"12345"}
Then get your code to be able to parse the string and compare to the constant pin_code. You can Google "Compare string in C" or similar to find code for this.
Once you have this working you can then add the features of storing the pin_code in eeprom. The functions to do this are in the manual.
HTH - Steve H. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|