__FORCETOC__ This is the current status of the Database. At present, the read and write functions for passing arrays into and out of the EEPROM is working, but only for byte format arrays. see [\#Code](#Code "wikilink") for the full explanation of each function. EEPROM ------ Having finished the library of functions entirely, I have put the code up on Google Code, with a wiki and a zip of the latest version. The Google Code page is [here](http://code.google.com/p/arduino-exrom/). Behaviour --------- Following is a dump of the serial output from the Arduino. Checking for Database Database not present: Creating Database HeadID: 250 HeadData: 0 Printing DB 0 No Tags in Database Adding Entry to DB Printing DB 1 EntryID: 0 Entry Data: 0CCCCCCCCC Entry already present at ID0 Adding Entry to DB Printing DB 2 EntryID: 0 Entry Data: 0CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC Entry already present at ID0 Entry already present at ID1 Adding Entry to DB Printing DB 3 EntryID: 0 Entry Data: 0CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC EntryID: 2 Entry Data: 2CCCCCCCCC Printing DB 2 EntryID: 0 Entry Data: 2CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC Printing all entry bays EntryID: 0 Entry Data: 2CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC No entry at ID 2 HeadID: 250 HeadData: 2 Checking for Database Database present HeadID: 250 HeadData: 2 Printing DB 2 EntryID: 0 Entry Data: 2CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC Entry already present at ID0 Entry already present at ID1 Adding Entry to DB Printing DB 3 EntryID: 0 Entry Data: 2CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC EntryID: 2 Entry Data: 0CCCCCCCCC Entry already in Database Printing DB 3 EntryID: 0 Entry Data: 2CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC EntryID: 2 Entry Data: 0CCCCCCCCC Entry already in Database Printing DB 3 EntryID: 0 Entry Data: 2CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC EntryID: 2 Entry Data: 0CCCCCCCCC Printing DB 2 EntryID: 0 Entry Data: 0CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC Printing all entry bays EntryID: 0 Entry Data: 0CCCCCCCCC EntryID: 1 Entry Data: 1CCCCCCCCC No entry at ID 2 HeadID: 250 HeadData: 2 Code ---- /* EXDB - Database functions based on the EXROM library Copyright(c) 2010 Tom "TBSliver" Bloor. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #define HEADER_P 0 #define HBYTE 250 #define EBYTE 251 #define MAXMEM 512 // Max memory allocated to the database //DO NOT TOUCH union Header { byte raw[3]; struct Data { byte hByte; int noTag; } data; } header; //END OF DO NOT TOUCH AREA union Entry { byte raw[11]; // must be the same size as the Data struct. //remember that ints are 2 bytes, floats, longs etc. are 4. struct Data { //Needed for functionality byte eByte; union EData { byte raw[10]; //must be same size as the PData Struct. struct PData { //Customize this bit! byte anyData[10]; //End of custom area } pData; } eData; } data; } entry; //demo tags for testing byte tag0[10] = { 0,12,12,12,12,12,12,12,12,12}; byte tag1[10] = { 1,12,12,12,12,12,12,12,12,12}; byte tag2[10] = { 2,12,12,12,12,12,12,12,12,12}; byte tag3[10] = { 3,12,12,12,12,12,12,12,12,12}; byte tag4[10] = { 4,12,12,12,12,12,12,12,12,12}; byte tag5[10] = { 5,12,12,12,12,12,12,12,12,12}; byte tag6[10] = { 6,12,12,12,12,12,12,12,12,12}; /* void setup() { Serial.begin(9600); createHead(); printDB(); addEntry(tag0); printDB(); addEntry(tag1); printDB(); addEntry(tag2); printDB(); delEntry(0); printDB(); Serial.println("\r\nPrinting all entry bays"); printEntry(0); printEntry(1); printEntry(2); Serial.println(); } void loop() { } */ //Customize to print the data inside the PData struct. void printEData() { Serial.print(" Entry Data: "); for(int i=0;i<10;i++) Serial.print(entry.data.eData.pData.anyData[i], HEX); } /*----------------------------------------------------- DB -----------------------------------------------------*/ void printDB() { Serial.println("Printing DB"); readHead(); Serial.println(header.data.noTag); for(int i=0;i MAXMEM) { Serial.println("Database Full"); return false; } else { Serial.println("Entry already in Database"); return false; } } void delEntry(int entryID) { readHead(); byte eEntry[sizeof(entry.raw)]; for(int i=0;i