Problems with driving external EEPROM M24256


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    974


    Did you find this post helpful? Yes | No

    Default

    I think you need to split the address in the I2c command as low and high byte for this to work.

    JF

  2. #2
    Join Date
    May 2007
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Tnx. for fast reply, Jerson! Were you were meaning to send lower and higher address byte separately to EEPROM for reading and writing?

    Example:

    I2Cwrite DPIN, CPIN, cont, addr.Byte0, [val] 'Writes value to EEPROM address 1
    I2Cwrite DPIN, CPIN, cont, addr.Byte1, [val] 'Writes value to EEPROM address 1

    In EEPROM datasheet it is described, that the address should be sent in two parts and then data byte. In PICBasic PRO Compiler book it is also written, that address is sent in bytes or words. It is determined by the size of the variable, that is used.

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    974


    Did you find this post helpful? Yes | No

    Default

    This is what I use to address a 24C512 device

    Code:
      I2Cwrite  SDA, SCL, $A0, Address.HighByte, Address.LowByte, _
                [Date[0],Date[1],Date[2],Time[0],Time[1],Time[2],Key]
    Hope this is what you're looking for

    JF

  4. #4
    Join Date
    Dec 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Post M24256 Eeprom

    I had the same problem with the 24aa eeprom , I had to check the data sheet to find out what the address var should be either byte or word and the make sure the data line and the clock line have pull up resistors,

    Good Luck
    Mike
    P.S. just checked the data sheet quickly and I think the address value should be byte and WC line should be held low during write or the ACK will not be sent..
    Last edited by mbruno; - 31st January 2008 at 08:46. Reason: checking the data sheet for information

  5. #5
    Join Date
    May 2007
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    This address splitting seems logical and I tried it, but unfortunately it didn't change the result. Anyways it remains in my code.

    Also I was adding to data line pull up resistor as it was said in datasheet. Now the "val2" value is 16.

    In datasheet it is said, that each data byte in the memory has a 16-bit address. The Most Significant Byte should be send first and then Least significant. As I understand the address must be word type variable.
    I was checking the routing of reading process. This sequence is a bit different than in writing process.

    Read sequence:
    Start => Control => Address.HighByte => Address.HighByte => Start => Control => Data Out

    Here the Control byte and Start condition has to be send twice. In writing it is without second Start and Control. I don't know how the I2C protocol is set. Perhaps for reading it should be also done something different.

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. Replies: 1
    Last Post: - 28th January 2010, 22:15
  3. Replies: 5
    Last Post: - 24th June 2009, 03:01
  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