CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Help plz in this project !!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








Help plz in this project !!
PostPosted: Sun Feb 08, 2009 7:49 am     Reply with quote

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);
  }
}
Guest








PostPosted: Sun Feb 08, 2009 10:45 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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