Storing user input - whassall that about then?


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default Storing user input - whassall that about then?

    So I have a very simple program, with a 'variable' preset by me, but my simple program allows a user to override the content of the variable (by turning a potentiometer & pushing a switch to confirm)....ok, all is good - I know how to do that.

    But then the PIC is powered off ....alas, when it's next powered up again, the variable is going to be populated with my default value again - that's gonna get tiring very quickly if everytime the pic is powered up, the user has to enter his preferred value each time.

    So how can I implement a solution so that *if* the end user changes the variable (from default), then this updated variable is saved (to be read when the PIC is next powered up)

    Now I know it's going to involve writing something to non volatile memory - how do I do that & more importantly, how can I instruct my PIC to go & get the value?!

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    To start go here and look at the eeword example
    http://melabs.com/resources/samples-pbp-general.htm

    Then when the user changes the VAR it is written to the EEPROM.
    At the beginning of the code, at startup, the EEPROM location will be read and the value moved to the VAR in question.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    To start go here and look at the eeword example
    http://melabs.com/resources/samples-pbp-general.htm

    Then when the user changes the VAR it is written to the EEPROM.
    At the beginning of the code, at startup, the EEPROM location will be read and the value moved to the VAR in question.
    Many thanks for the link - I've looked at it a couple of times & then had to lie down.

    I'll give it a few more peaks over the weekend (I'll likely stand on my chair trying to catch the info going above my head!)

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You may find this useful too.

    EEPROM Variables (EE_Vars.pbp)
    http://www.picbasic.co.uk/forum/showthread.php?t=2444

    The "Linked Variables" does exactly what you're looking for. Post #4.

    hth,
    DT

  5. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    You may find this useful too.

    EEPROM Variables (EE_Vars.pbp)
    http://www.picbasic.co.uk/forum/showthread.php?t=2444

    The "Linked Variables" does exactly what you're looking for. Post #4.

    hth,
    Many thanks Darrel, that looks it'll fit the bill perfectly.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts