Looking for eeprom database/table examples
I'm looking for any examples of using external eeprom to store lookup data used with a BS2.
I'm looking for something along the lines of the way the data command allows a variable name to represent an eeprom address location.· I'd like to be able to search for a value in eeprom (like an index), then return a related value( like a second field of a data row).
Thanks,
Cdub
Post Edited (cdub) : 8/7/2006 2:11:20 AM GMT
I'm looking for something along the lines of the way the data command allows a variable name to represent an eeprom address location.· I'd like to be able to search for a value in eeprom (like an index), then return a related value( like a second field of a data row).
Thanks,
Cdub
Post Edited (cdub) : 8/7/2006 2:11:20 AM GMT
Comments
This is a simple code fragment that is called as a GOSUB lookFor. It uses a table in program EEPROM of pairs of words.
The first of a pair is an index that's matched against goalItem. If a match is found, secondItem is set to the second of
the matching pair. If firstItem is zero, no match was found because the terminating zero was found.
If you want to use an external EEPROM, you could use the I2C command set to access the EEPROM and simply substitute
an I2CIN statement for the READ statement like (with i initially zero and all variables here are words):
I'm currently using sample code found at the 24LC128 product page for the BS2, but it only shows how to set a value then immediately read it back.· It is useful as a start but not robust enough for my application.
this is the link: http://www.parallax.com/dl/docs/prod/oem/24LC128-v2.0.pdf.
I'm basically trying to use external eeprom in the taos color sensor example(by jon williams), but with many more colors in a lookup table.
Here is the link:
http://downloads.nutsvolts.com/Color_Scan.BS2
Post Edited (cdub) : 8/7/2006 3:05:20 AM GMT
You can also use external EEPROM's with an SPI/Microwire interface, and use the SHIFTIN and SHIFTOUT commands.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
You probably would have one program to set up the table in the EEPROM and another program
to actually use it for your color sensor table.