Go Down

Topic: SPI EEPROM & GPS logging (Read 817 times) previous topic - next topic

shezi

Feb 23, 2010, 08:02 am Last Edit: Feb 23, 2010, 08:03 am by shezi Reason: 1
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.

http://www.arduino.cc/en/Tutorial/SPIEEPROM

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.

Thanks


PaulS


shezi

does it also work for SPI interfaced EEPROM?

PaulS

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

Grumpy_Mike

#4
Feb 25, 2010, 11:08 pm Last Edit: Feb 25, 2010, 11:11 pm by Grumpy_Mike Reason: 1
Quote
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

Go Up