Shop OBEX P1 Docs P2 Docs Learn Events
Best way to store lead screw position data when power is off?? — Parallax Forums

Best way to store lead screw position data when power is off??

w4fejw4fej Posts: 264
edited 2011-10-08 09:01 in Propeller 1
I'm hard at work on a positioning system for a project and want to add "memory channels" to the device so that I can return to the same spot in the future... Whats the best way to do this with the prop?? I'm looking at maybe 30-40 locations holding values in the zero to maybe 800 range or so..

I could supply 12vdc ALL the time if needed to keep the data alive.. In relation to the Prop speed the memory locations will hardly ever be accessed/written to.

SD card?? EEPROM?? What's the hot ticket here?

Thanks, Mike B.

Comments

  • Clive WakehamClive Wakeham Posts: 152
    edited 2011-10-08 05:13
    24XX128 EEPROM is a I2C compatible device with 16K of storage space. Which should be the right size for your storage needs.

    http://www.wulfden.org/downloads/datasheets/24AA128,24LC128,24FC128.pdf

    There are several I2C objects in the OBEX.

    Since your values are up to 800, you will need to store in "long values"...
  • PublisonPublison Posts: 12,366
    edited 2011-10-08 05:57
    I think the easiest solution is to use a 64K EEPROM (24LC512) where your Prop program would live in the lower 32K, and your data would be in the upper 32K. The Propeller Tool does not over write the upper 32K..

    Jim
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-10-08 06:14
    You are talking about 80 bytes of memory if you are holding 40 locations with a maximum value of 800 or so. The Prop's program EEPROM is more than able to look after this and you can access them as normal variables which get automatically loaded upon reset if you use the method of updating to the EEPROM at the same address as the variable. i.e. if your variables are an array declared as " word memory[40]" then all you need to worry about is when you update a memory (say #20) is to use the equivalent functions of EEPROM WRITE WORD(@memory[20],memory[20]). It may be more expedient to use longs rather than words if it makes it any easier. What happens is that the RAM program is loaded from the EEPROM image at boot but this also includes the initial values of the variables. Since it's an image the corresponding location in EEPROM is mirrored into RAM so using the address of the variable "@memory[20]" is all that is needed to update the EEPROM image of that variable.

    If this is what you are after and you are not sure about the I2C object to use and how to use it then just ask, it's quite easy.

    How often will these "memories" need to be updated? There is a limit as to how many times you can update a EEPROM location (minimum 1 million times or so).
  • w4fejw4fej Posts: 264
    edited 2011-10-08 09:01
    You are talking about 80 bytes of memory if you are holding 40 locations with a maximum value of 800 or so. The Prop's program EEPROM is more than able to look after this and you can access them as normal variables which get automatically loaded upon reset if you use the method of updating to the EEPROM at the same address as the variable. i.e. if your variables are an array declared as " word memory[40]" then all you need to worry about is when you update a memory (say #20) is to use the equivalent functions of EEPROM WRITE WORD(@memory[20],memory[20]). It may be more expedient to use longs rather than words if it makes it any easier. What happens is that the RAM program is loaded from the EEPROM image at boot but this also includes the initial values of the variables. Since it's an image the corresponding location in EEPROM is mirrored into RAM so using the address of the variable "@memory[20]" is all that is needed to update the EEPROM image of that variable.

    If this is what you are after and you are not sure about the I2C object to use and how to use it then just ask, it's quite easy.

    How often will these "memories" need to be updated? There is a limit as to how many times you can update a EEPROM location (minimum 1 million times or so).

    Ok thanks to all who replied..

    This situation is very much like the "Buttons" on your car radio. Once you set the station you seldom need to update/change them. Your last statement about the write limits is exactly why I posted this question. At 1 million times, I guess it is unlikely I will EVER wear out the chip.. lol.. This app is very simple in that all it has to do is run a motor controller to move a lead screw once in a while and track the pulses generated by the lead screw rotating and display the number on a 2 X 16 serial LCD. The other task is to store/manage the "stations" memory values. That's pretty much it.
    Thanks.. Mike B.
Sign In or Register to comment.