Shop OBEX P1 Docs P2 Docs Learn Events
Fempto Basic and PE Kit Lab Applications – EEPROM Datalogging and I2C — Parallax Forums

Fempto Basic and PE Kit Lab Applications – EEPROM Datalogging and I2C

RaymanRayman Posts: 14,162
edited 2007-10-03 01:24 in Propeller 1
I like idea of using the "PE Kit Lab Applications – EEPROM Datalogging and I2C·" to save current settings in my app to eeprom.· But, I also like the idea of using "FemtoBasic" to load up different apps from an SD card.

I haven't tried it yet, but I have a feeling that these two things would be incompatible.· I wonder if there's a simple way to use/modify FemtoBasic and the EEPROM Datalogging code to make it work...

I guess it would have to detect whether or not the current App in RAM is the same as the one in EEPROM.· If so, then save settings to EEPROM.· If not, then save settings to SD card.· But, I don't see how the app could know where it came from on the SD card...

Maybe it would be good enough just to make sure the App in RAM is the same as the one in EEPROM before saving anything there...

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-03 01:20
    You could define a specific constant (like some unique STRING("xxxxxx")) and see if the RAM and EEPROM contents at that address match.

    You could easily modify FemtoBasic to add a function to return the starting sector number of a file on the SD card, then write this sector number to the last 4 bytes of EEPROM and then run the program. The program would fetch the starting sector number from EEPROM and could use it to read/write to the SD card image of the program using only the low level SD card I/O routines. If you use the routines from FemtoBasic, you get both EEPROM and low-level SD card I/O together.

    This way, you don't need to include the FAT filesystem routines in your program.· The Spin loader in FemtoBasic requires that the program file be contiguous for the 1st 32K (the only part it uses).· As a result, you should be able to read/write any 512 byte page in the file and store your data much as you would do with an EEPROM copy.


    Post Edited (Mike Green) : 10/3/2007 1:24:58 AM GMT
  • RaymanRayman Posts: 14,162
    edited 2007-10-03 01:24
    Thanks Mike! Those are very good ideas. I was hoping you'd respond...
Sign In or Register to comment.