This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DIFFERENCE IN 24C04 & 24C64 EEPROM C CODE

I have written code which correctly works with EEPROM 24C64 but when i replaced it with lower memory 24C04, same code is not working.

Please help if anybody know why is it happening.

  • There are errors in your code. Which you have not shown.

    But these two chips are not compatible (different number of address bytes), so it's no surprise that the same code would not work. Read the datasheet.
  • Thanks for reply Clemens Ladisch,

    My code is working correctly without any trouble with 24C64, but not with 24C04.

    I read about the difference in address etc between these two chips, but things are not clear.

    Can you please provide me a working code for 24C04.

  • Suman,

    the chance that someone has exactly the code you need is very little. Why not debug the code you have to find out where the problem is located.

    Dennis
  • If you do not understand how your existing code relates to the characteristics of the 24C64, you will not understand how to use the 24C04 either.

    If you want somebody else to write the code for you, you have to hire him.
  • I wrote my problem here to get support not lecture. Its very easy to give lecture guys.
    If you cant help, stay away.

    Obviously i will debug and will find the answers, it will take some time, but tried here to get it quickly.

    Anyway thanks for mind blowing knowledgeable lectures.
  • You decided to keep your code secret (both the old one and your attempt at the new one). How do you expect anybody to be able to help you?
  • Please find my code, working correctly with 24C64 and abobe.

    i2c_rd_wr.h

    5672.sb_define.h

  • There is no need to get mad now. Clemens is absolutely right - if you request help you also have to give some information to work with. Your input was "I have code that works with EEPROM A, but it does not work with EEPROM B - why?" How shall one know? The only answer you can expect is something like: "Your code is wrong!" And you already got that. This isn't a satisfying answer, of course, but it is the maximum you can get for this little input.
  • Why don't you use the MSP's communication module? Which MSP do you use? There are code examples that show how to initialize and operate I²C communication with a communication module like USI or USCI, without all these delays and port function switching.

  • How do you expect anybody to be able to help you?

    Already after the third post, I got the impression that this is a "do my homework quickly" request. Further posts reinforced that suspicion - especially the aggressive style when being averted ...

  • The 24C64 datasheet says:

    The device address word consists of a mandatory one, zero sequence for the first four most significant bits as shown. […] The 32K/64K uses the three device address bits A2, A1, A0 to allow as many as eight devices on the same bus. […]
    A write operation requires two 8-bit data word addresses following the device address word and acknowledgment.

    The 24C04 datasheet says:

    The device address word consists of a mandatory one, zero sequence for the first four most significant bits as shown. […] The 4K EEPROM only uses the A2 and A1 device address bits with the third bit being a memory page address bit. […]
    A write operation requires an 8-bit data word address following the device address word and acknowledgment.

    So you have to change how you send the address.

    Your code already contains a mechanism to change this (two_byte_address), but it was commented out. And you have to put the ninth bit into the address byte.

  • Clemens is on the right track, the AT24C64 requires a two-word address as compared to one word for the AT24C04. Changing the write commands accordingly will most likely fix the issue. You will also now have to give attention to a memory page address bit.

    Regards,
    Ryan

**Attention** This is a public forum