I2CREAD issues with 24FC512 EEPROM


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156

    Exclamation I2CREAD issues with 24FC512 EEPROM

    I've discovered a problem when using a PIC18F67J60 and 24FC512 EEPROM.

    I've had this project in the field for several months now, and am just recently getting problems when I try to read a byte from the EEPROM. The code looked like this:

    I2CREAD SDA,SCL,RD,(BCONFIG+KEY),[VTYPE]
    PAUSE 5

    The EEPROM holds "1" in this location, but has recently started to return "0".

    If I do the addition first, the problem goes away, and the EEPROM returns "1" reliably!

    MEM=BCONFIG+KEY
    I2CREAD SDA,SCL,RD,MEM,[VTYPE]
    PAUSE 5

    I have just switched from ver 2.50 to 2.60, and some of these units have been recompiled using the new compiler. I have no other explaination for why this might be happening. Has anyone else determined that the math had best be done prior to the actual read? (Changing the pause time has no effect by the way.)

    Just curious.

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    I'm not sure why it has changed, but is there really a problem with calculating the address first? Sounds to me like you have solved the problem.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  3. #3
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Not at all. It's just a curiosity, and a slight concern for the units already deployed. Lesson learned.

  4. #4
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86


    Did you find this post helpful? Yes | No

    Default

    I had a similar problem with the write command. DT said it had something to do with adding LONGs in 2.6. You can see his response here

    Maybe something similar happened with the I2CREAD command

    David

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I try to avoid doing Math in any I2CREAD or I2CWRITE statement. Do it first and keep the statements as clean as possible. Always do what the book says. It says use a particular kind of variable, then use a particular kind of variable. It doesn't say Math is allowed, and doesn't show you examples with Math - so don't do it.

    You DON'T need PAUSEs for READING - you can do that at top speed. You DO need them for writing - the EEPROM Datasheet will tell you how much is required.

  6. #6
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Thumbs up

    Thanks Luckyborg. Think DT answered the question, and will keep an eye on patches to 2.60.

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. How to define constants that specify eeprom addresses
    By DwayneR in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th December 2009, 04:07
  3. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  4. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

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