Skip to content
AsherGlick edited this page Aug 30, 2011 · 19 revisions

Currently the only way to add tags to the program is to hard code them into an array. In order to do this you need to find the function in the code called addNames(). The entire function looks like this

/********************************* ADD NAMES *********************************\
| This function add allocates the amount of memory that will be needed to     |
| store the list of names, and adds all the saved names to the allocated      |
| memory for use later in the program                                         |
\*****************************************************************************/
void addNames(void) {
  namesize = 2; // number of IDs in the access list
  names = malloc (sizeof(int) * namesize);
  // change or add more IDs after this point
  names [0] = 12345;
  names [1] = 67890;
}

namesize = 2; is important it tells the program how much memory to allocate for the numbers
names[N] is also important where N is a number less then namesize If i wanted to add another tag to the array i would change namesize to 3 and set names[2] equal to the new tag

void addNames(void) {
  namesize = 3; // number of IDs in the access list
  names = malloc (sizeof(int) * namesize);
  // change or add more IDs after this point
  names [0] = 12345;
  names [1] = 67890;
  names [2] = 13579;
}

All the tags that are currently in the program can be removed or replaced because they are just place holders. If you keep them in then you will be granting acess to anyone who happens to have the tag 12345 (the tag 67890 does not exist because 16 bits can only count up to 65535).

Future Versions

Future versions of this program will have a different method of adding names to a list. This function is due to be modified soon to get rid of the requirement of setting namesize, this will prevent the user from even being able to make the mistake of not changing it to the proper number of tags (as I have done so many times) I hope at that point the code will look more like

void addNames(void) {
  // change or add more IDs after this point
  names = {12345,
           67890,
           11121,
           31415}
}

Another version is that in which the tags are stored in EEPROM, this is the best way to store the tag data and will eventually be the sole way of storing data. On the ATMEGA328 there is 1kB of EEPROM so the maximum amount of tags that will be able to be stored is 500 because each tag is two bytes long (16bits)

When this method is added I will release an Eagle Cad File of The Board 2 layers and add an extra button for "programming mode" which will allow you to hold it down and scan a card to add it to the database

Clone this wiki locally