SPI EEPROM & GPS logging

I have got the exact same chip for an EEPROM as stated on the website tutorial for SPIEEPROM. I also got the hardware interfacing and everything to work using the code provided.

Now I would appreciate some help to understand how to store a “long int” number instead of the “char” as shown in the code. As from the website it seems that you can only write 128 bytes at a time and since in that example they used char (which is 1 byte) they just SPI transfered in the following code:

for (int I=0;I<128;I++)
spi_transfer(buffer*); //write data byte*

  • }*
    How would this change for a long int (which is 4 bytes, 32 bits). How would the addressing be affected?
    PS: I want to store “latitude, longitude” that comes out of the TinyGPS library functions.
    Any sample code or nudge in the right direction to explain the EEPROM addressing and storage will be appreciated.

Have a peek at how it's done here:


does it also work for SPI interfaced EEPROM?

The techniques for addressing the memory where the long/int/float/double/etc. is stored byte-by-byte will.

does it also work for SPI interfaced EEPROM?

No it is for internal memory. The same techinque can be used for external memory but you have to write the bits that actually access the memory.

Look at this for external memory. http://itp.nyu.edu/~gpv206/2008/04/making_the_most_of_arduino_mem.html more specifically:- http://www.arduino.cc/en/Tutorial/SPIEEPROM