Menu

need to write a value to eprom

Help
2008-12-15
2013-05-30
  • Nobody/Anonymous

    on a 12f629 how can i write a value to the eprom(1,1)  when i program it, so that it has an intial value of 1 and then the pic will make changes to it as it runs, i only need that value put in once ever, so I can't have it in the code for the pic?

     
    • Nobody/Anonymous

      Something like this?
      The EEPROM addresses can all wipe to FF on first programming, so you can sense this and use it to do a single write. Successive power-ups won't change the existing value (providing that you don't change it back to FF).

      --- startup code ----
      .
      .
      x=EPread (1)
      if x=0xFF then EPwrite  (position,somevalue)
      .
      .
      --- end of startup code ---

      Main
      .
      .
      EPwrite (position,newvalue)
      rest of program
      .
      .
      goto Main

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.