Shop OBEX P1 Docs P2 Docs Learn Events
variable storage to EEPROM — Parallax Forums

variable storage to EEPROM

BeagleBeagle Posts: 7
edited 2011-02-18 10:08 in Propeller 1
I'm continuing on a project which has been running for about 14-months. I'm using a group of high accuracy temperature sensors, humidity sensors and barometers to try to map variations in air-density in a calibration lab. The measurements from this project are intended to be Traceable and are part of a Quality Control System. Therefore, I am performing periodic calibrations of the sensors. I have been correcting calibration errors in the sensors by updating the spin code in each of my propellers with a linear equation for each sensor. This has several disadvantages (not the least of which is keeping a separate copy of the code for each of the propellers) and I need to change my evil ways to a more wholesome code that features calibration coefficients that can be updated from a serial terminal and stored to the EEPROM. When the propeller is reset, as part of the startup routine, I'd like to read the coefficients from the EEPROM and use them as variables in the program.

Will someone please explain how to write to and read from the EEPROM? At the moment, I'd like to store and use numerical variables which will be used in linear equations.

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-02-17 19:18
    Look in the OBEX for I2C objects. The code comments explain how to read/write to EEPROM. BUT... I beleive if you have the 32k EEPROM your data will be overwritten when the Prop restarts.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-02-17 19:18
    I am assuming you are talking about the boot EEPROM? If so, what is the size of the EEPROM on your board? It will need be be bigger than 32 kilobytes if you want the data to survive a program EEPROM cycle. You should look in the OBEX for I2C libraries and check the included programs in the Propeller IDE for a I2C demo. Reading/writing to a EEPROM is not very hard. It will just use a few lines of code at the most...
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-17 20:01
    You might look at this object in the OBEX. It lets you store parameters as named items in EEPROM.
  • BeagleBeagle Posts: 7
    edited 2011-02-18 10:08
    Yes indeed I am using the 32KByte 24LC256.
Sign In or Register to comment.