Method 1.
Store the numbers in EEPROM in ASCII format. If you try to convert to a just a numeric value, you will lose leading zero's.
When they are first added, they are SORTED and stored in numeric order.
There is no time penalty READING from EEPROM, just when writing. Looking through a pre-sorted list will be extremely fast.
If the SORTING takes too long when adding the number, use Ramtrons FRAM or similar.
Method 2.
Store the numbers randomly in EEPROM, but each record contains a HASH KEY which is assigned as it's SEARCH CODE. The HASH KEY (look up HASH KEYS on internet) can be a simple BYTE containing the summed compliment of all the bits in the telephone number (a little like a simple CRCC sum check), or it can be a more sohisticated result.
example: http://www.concentric.net/~Ttwang/tech/inthash.htm
The incomming telephone number is similarly hashed and checked across the stored HASH values, only the ones that match (a simple HASH algorythim could produce identical HASH Keys) are then sequentially scanned properly. A method like this will eliminate 95% (or more) of the search task. You use this method for storing large numbers of Records in Databases that require RANDOM rather than SEQUENTIAL access.
Method 3.
C'mos Guy's, this is easy 1st Year student stuff... overdosing on Chocolate must have dulled the Grey matter this Easter...
Bookmarks