Write. Read. (How hard can it be?)


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52

    Default Write. Read. (How hard can it be?)

    Hi all,
    I'm using a 16f819, which is rumored to have 256 bytes of EEprom. I should be able to define 7 simple byte variables, with 1 or 0, and depending on switch states, write these values to memory so we can remember where we left off the next time we start up.
    Using the exact example from the pbp book,
    SW1 = 1
    led1 = 0
    Write 0, SW1
    ...do something else for a while....
    read 0, SW1
    if SW1 = 1 then
    led1 = 1
    endif

    Is the issue the address space? Could I use 0 through 6? I don't get what the datasheet is telling me.
    Thanks
    Gary

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    It is no rumour, the PIC16F819 does have 256 bytes of EEPROM.
    What is the problem that you are having?

  3. #3
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Sorry, guess I forgot to ask....

    The data does not seem to be written, or read (not sure which is failing). If I set the led to blink based on the value of the variable, it does not seem to correspond to the value I am writing.

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


    Did you find this post helpful? Yes | No

    Default

    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    Your programmer may be your friend here. My first choice is a humble PICkit2, which allows EEPROM data to be written and read back out too.

    So you can set the initial value, run your program see it that works (to debug reads), then push your buttons and see if the correct value gets there (to debug your writes).

Similar Threads

  1. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  2. write -read problem?
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th August 2009, 13:06
  3. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  4. Q: using MCLR for Input on 12F683
    By picster in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 31st January 2009, 15:25
  5. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19

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