Shop OBEX P1 Docs P2 Docs Learn Events
Power Down Memory Save — Parallax Forums

Power Down Memory Save

I'm designing a very simple motor control panel using a rotary encoder connected to a Prop1. The user selects the desired RPM via the encoder. The Prop1 then outputs to a DAC to generate a 4-20mA control signal to a COTS motor driver.

On powering down, I would like the Propeller to write the current RPM set point to non-volatile memory. That way, the user doesn't have to re-dial the RPM setting from 0 each "day". I'm concerned about writing to the EEPROM too frequently, as I know these are life limited. I thought it might be best to monitor the input voltage and when it drops below a certain value, write to the EEPROM. Of course I would have to have some "hold-up" capacitance and monitor the voltage up stream of that. I'm just having a little trouble picturing it all. Wondering if anyone has gone down this path before and would be willing to share.

Thanks in advance!

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-07-04 05:06
    Write to the EEPROM whenever you change the setpoint, you will wear out the button/encoder before you even get close to wearing out the EEPROM. You can use a delayed write so that you only write it once. Remember that 1 million writes is the "minimum" and I did and test once and gave up when I got close to 10 million writes.

    Just use an RC DAC plus an opamp to generate 4-20ma.
  • That was another option I considered. When the value changes, wait 1-3 seconds after it stops changing and write to memory.

    Could you elaborate on the "RC DAC"?

    Thanks!
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-07-04 05:31
    That's what I meant by "delayed write". Trying to only write on power-down requires power-fail detect circuitry, a sense line, a cog and software dedicated to sensing that, and fingers crossed that the power rail remains stable etc etc. Always a bad idea but the only option we had in the bad old days.


    Each cog has two counters that can be used in a variety of modes and duty cycle mode (not quite PWM) is suitable for connecting to an RC network to filter the duty cycle pulses from 0...100% duty to a voltage of 0 to 3.3V. You can use this voltage to control a simple current generator circuit using a transistor or opamp. We can generate audio waveforms with this or simply a set-point voltage.
  • Got it. Thanks again!
  • Instead of trying to write on power fail, use an IIC or SPI battery RAM or RTC with memory like the DS1307, and write as often as you want.
  • localroger wrote: »
    Instead of trying to write on power fail, use an IIC or SPI battery RAM or RTC with memory like the DS1307, and write as often as you want.

    That's a good suggestion as well. I had considered a current date/time display, but didn't know where to start. I'm using a 4x20 LCD dot matrix screen (New Haven NHD-0420DZ-NSW-BBW) to provide some feedback to the user. Maybe I can add this feature at some point.
Sign In or Register to comment.