Determine Tag Numbers and Plan Database

First, you need to load the EEPROM fonts into your FLiP. Simply drag this block onto your Blockly workspace and download to the FLiP’s EEPROM.

Next, we’ll determine the numbers on your various RFID tags. Each tag has a seven-digit integer number (plus a few other numbers that represent the vendor ID, but we’re not using them in Blockly). The FLiP - RFID Reader for Numbers Blockly program can be used to read the tags and write their numbers to your OLED. Download it here:

Project4261-RFID-Read-Numbers.svg

Scan your tags and write the numbers you see from the OLED. The tag numbers I recorded were 2819869, 6618834, 2809834, 2810865 and 2841692. Yours will be different.

The next step would be to identify the names you’ll associate with the RFID tag numbers. Each RFID tag number is four bytes. Four bytes is 32 bits - or a word variable - which stores a number between zero and 2,147,483,647.

This example will associate the RFID tag number with the names of five recent presidents. Since the OLED’s maximum number of characters (using medium sans font) is eight we’ll use that as a limitation. The first and last name of recent presidents are each less than eight characters.   

When reading from memory it’s a good idea to arrange your data consistently. For example, 20 bytes can store the RFID tag number, first name, and last name of the president in the following format:

  • RFID tag number in bytes 0 through 3 (four bytes)
  • President’s first name in bytes 4 through 11 (eight bytes)
  • President’s last name in bytes 12 through 19 (eight bytes)
  • Every 20 bytes can be used for another record, as shown below.

It’s helpful to know exactly where this data is stored in the Propeller’s EEPROM, too. The FLiP uses a 64K byte EEPROM - with the lower half (32K bytes) being used for your program memory. This leaves the upper 32K bytes of space for storing other data. However, the Blockly creators allocated sections of this upper half of memory for the ActivityBot encoder calibration data and OLED fonts. This left locations 32,769 to 40,444 (7,675 bytes) for data of your choice.

Using our example with the RFID tag numbers and president names, 7,675 bytes could store 383 records (7,675 bytes divided by 20 bytes per record). This may be plenty of space for storing the presidential records, but imagine keeping track of weather data or inventory. For those projects it would be better to use the SD Card blocks. A look at how this 64K EEPROM memory is organized:  

Blockly also conveniently recalculates the memory locations so you can write to location 32,768 as location 0. A quick look at the C code equivalent shows how this is accomplished for you by adding 32,768 to your memory location:

void write_numbers_and_names_to_EEPROM()

{

   // RFID tag numbers take four byte locations

   // names take two eight byte locations

   ee_putInt(2819869, (32768 + constrain(0, 0, 7675)));

   ee_putStr(("Bill"), (strlen(("Bill")) + 1), (32768 + constrain(4, 0, 7675)));

   ee_putStr(("Clinton"), (strlen(("Clinton")) + 1), (32768 + constrain(12, 0, 7675)));