PDA

View Full Version : Storing numbers for caller ID?



Rob Martin
- 27th March 2005, 12:49
Is there a simple way to store 10 digit numbers in NVR then search the NVR for a match?

I want to store at least 100 numbers and then search them compared to a CLI received via a caller ID unit I already have?

So to store 9999999999 this would be 3B9AC9FF in hex but as far as I understand can not store a single number this large.

Rob

NavMicroSystems
- 27th March 2005, 16:11
Rob,

How about BCD?

Rob Martin
- 27th March 2005, 19:16
Rob,

How about BCD?

I could write a routine to store 1001010100000010111110001111111111
So what would be the best way to search? Ideally I need to search the 100 numbers in under a second.
Any thoughts?

NavMicroSystems
- 27th March 2005, 22:41
Rob,

Taking your example, BCD would result in

$9999999999
or
%1001100110011001100110011001100110011001

do you see the difference?

Rob Martin
- 28th March 2005, 08:59
Rob,

Taking your example, BCD would result in

$9999999999
or
%1001100110011001100110011001100110011001

do you see the difference?

After a quick search on Google yes I do :)
But it does use more memory

1001100110011001100110011001100110011001
1001010100000010111110001111111111
Or is this an easier way to then search?
I guess I could search all the last numbers of each sequence for a match.
I assume i will have to devise so kind of memory allocation per number in order to make searching easier?
Any more clues?

**update**
Just done a quick search and found a previous post from you Ralph
http://www.picbasic.co.uk/forum/showthread.php?t=1015&highlight=eeprom
Could I not use this method to write and read my 10 digit string?


Rob

Melanie
- 28th March 2005, 10:27
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...