EEPROM Data Search

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

EEPROM Data Search

Postby PICTRAIL » Thu Jun 30, 2011 10:48 pm

Hi,
I would like to know how to search for a data in EEPROM without knowing the location.
I have an array of 6 char which i input through keypad. I want to search on my EEPROM if this data is available or not. Kindly give an idea on possible code system.

Thanks,
Ebby.
PICTRAIL
Apprentice
 
Posts: 40
Joined: Mon Dec 27, 2010 3:32 pm

Re: EEPROM Data Search

Postby aurora » Fri Jul 01, 2011 12:28 am

Assuming you store the 6 char in the first 6 address of your EEPROM;
and if all 6 char come in at the same time, just check the 6th character if it is a null value. For example, you pre-set all your EEPROM to a non-char (something that you know, i.e. 0xFE).

If the number of char is unknown, then you have to write a routine that check for the null value (i.e. 0xFE) and see where it is located. The search will start from EEPROM first address, until it found the null.
aurora
Discoverer
 
Posts: 126
Joined: Sun Jun 07, 2009 4:52 pm

Re: EEPROM Data Search

Postby shahrul » Fri Jul 01, 2011 12:57 am

You must know what is the expected data, then you check one-by-one address, compare is that the data.

But, I wonder, how do you don't know your data address? because you must program your EEPROM write. Why the data can be store in random address?
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: EEPROM Data Search

Postby robosang » Mon Jul 04, 2011 5:30 pm

agreed with the rest, you must read and compare the data byte by byte because it can be anything if you have lost the address of it being stored.

Check the 1st byte which you expected and try to match it with 2nd byte until all 6 bytes matched. Else discard the data and search the 1st byte again.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 6 guests

cron