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

Using the EEPROM to create a database with PIC16F877A

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



Joined: 23 Apr 2015
Posts: 9
Location: Pretoria

View user's profile Send private message

Using the EEPROM to create a database with PIC16F877A
PostPosted: Sun Apr 26, 2015 3:07 pm     Reply with quote

Hey guys, can you please give me ideas on how to store and update passwords and usernames on the internal eeprom of a pic16f877a for a gate controller. I am using the PIC C compiler to write the program. Thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Apr 26, 2015 5:20 pm     Reply with quote

Sample code which shows how to get a password from a keypad:
http://www.ccsinfo.com/forum/viewtopic.php?t=45935
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Mon Apr 27, 2015 1:30 am     Reply with quote

Understand also, forget 'database'.

A database is a very specific/complex thing. An organised collection of data, usually with a very complex set of access tools that allow it to be used intelligently in a lot of ways.

You do not have the code space, or the amount of data to warrant using a 'database'. What you probably want is something more like a card index. Simple record 'cards', carrying just a username and password (probably don't store the password, but just an encryption of the password - so input the password - generate perhaps a CRC32 of this, and store that - then when the user inputs the password for access, generate the CRC32 of what they enter, and test if this matches - saves space, and means that if the EEPROM is read, you don't have the password).
Don't get over complex. Code space and the size of the EEPROM limit what you can do. Fixed size records. perhaps 11 characters for the name, and four for the CRC of the password. One character for an 'in use' flag. 16 characters for each entry, allows 16 entries to be stored. If you need more, then you need to think of a larger ROM, or whether you can store less (do you really need the name?).
Then when you need to use them for access, generate the CRC from the input password, and simply read the records from ROM in turn, reject any where the 'in use' flag is not set, then test the CRC in the record against the one that has been input. If you have a match, then this is an authorised user.
It depends massively on what you actually want to 'do' with the data, but 256 bytes doesn't allow a lot.
ocsgPIC



Joined: 23 Apr 2015
Posts: 9
Location: Pretoria

View user's profile Send private message

PostPosted: Mon Apr 27, 2015 9:09 am     Reply with quote

Thanks PCM Programmer and Ttelmah. The hardware is all set and ready, i will now try to write the code and load about 10 passwords of 5 characters each and 10 usernames of up to 10 characters each in the eeprom. The part were you are saying there is no need to store passwords since the crc can somehow generate it and confirm it with the one entered by the user to grant access or not is still a bit confusing but i get the idea. Thanks a million!
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