Reading EEPROM data?


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Qacer's Avatar
    Qacer Guest

    Question Reading EEPROM data?

    Hi again all,

    I have the following code:

    Code:
    I2CWRITE I2CDAT, I2CLCK,addr,[fmwrt1,fmwrt2,fmwrt3,fmwrt4,fmwrt5], NOGO
    Pause 200
    I2CREAD I2CDAT, I2CLCK,addr,[fmred1,fmred2,fmred3,fmred4], NOGO
    WRITE 0,fmred1
    WRITE 1,fmred2
    WRITE 2,fmred3
    WRITE 3,fmred4
    I am trying to read the EEPROM data values, but I can't seem to get it to work. I think it maybe the fact that when I plug the chip back into the programmer, the code is executed again and (maybe?) overwriting the data in the same EEPROM address.

    Any tips?

    My main objective is to just read the current values from an I2C device and store those values in the EEPROM so I can view it using MPLAB.


    Thanks!

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


    Did you find this post helpful? Yes | No

    Default

    Maybe you could use another EEPROM location as a Flag, so that it only runs once.
    Code:
    READ 127,temp
    IF (temp <> 1) then
        I2CWRITE I2CDAT, I2CLCK,addr,[fmwrt1,fmwrt2,fmwrt3,fmwrt4,fmwrt5], NOGO
        Pause 200
        I2CREAD I2CDAT, I2CLCK,addr,[fmred1,fmred2,fmred3,fmred4], NOGO
        WRITE 0,fmred1
        WRITE 1,fmred2
        WRITE 2,fmred3
        WRITE 3,fmred4
        temp = 1
        WRITE 127, temp
    ENDIF
    P.S. You might need a Big pause at the beginning, to allow time to remove the power after programming.
    Last edited by Darrel Taylor; - 10th March 2006 at 01:25. Reason: Pause
    DT

  3. #3
    Qacer's Avatar
    Qacer Guest


    Did you find this post helpful? Yes | No

    Talking

    Ahh, thanks, Darrel! :-) This should work.

Similar Threads

  1. Data EEPROM gets clobbered during programming
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2008, 02:46
  2. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  3. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  4. Internal EEPROM Read/write Addressing Errors with 18F PIC's
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 18
    Last Post: - 12th July 2005, 19:42
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 0

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