|
|
View previous topic :: View next topic |
Author |
Message |
ocsgPIC
Joined: 23 Apr 2015 Posts: 9 Location: Pretoria
|
Using the EEPROM to create a database with PIC16F877A |
Posted: Sun Apr 26, 2015 3:07 pm |
|
|
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
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Mon Apr 27, 2015 1:30 am |
|
|
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
|
|
Posted: Mon Apr 27, 2015 9:09 am |
|
|
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! |
|
|
|
|
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
|