Maker Pro
Maker Pro

need help about the 24AA01

466576266

Mar 12, 2010
31
Joined
Mar 12, 2010
Messages
31
Dear all,

i meet with a problem recently, and i need your help.

I'm trying to read and write from the 24AA01 using the I2C .

my design is this: first, i write a data 0x88 into the 24AA01(address 0x02).then, i want to read the data(0x88) from the 24AA01. theoritically, i will get athe data 0x88. but what i get is 0xFF. and whatever i change the data , i can only get the data 0xFF. i donnt know what's wrong with my code, maybe something wrong with the hardware.
the picture and the c code are attached. so, i need your help.thank you.
 

Attachments

  • 24AA01_AT89C51.jpg
    24AA01_AT89C51.jpg
    63.1 KB · Views: 282
  • c for 24AA01.zip
    969 bytes · Views: 155

ElectronWorks

Aug 20, 2009
28
Joined
Aug 20, 2009
Messages
28
Your code looks OK. You have the START and STOP edges in the right polarity. You have not however, put in a 10ms delay when you WRITE your data. The E2 memory needs this to program each register.

If this fails, try commenting out the ACK lines as I2C will work without these

Let me know
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
If this fails, try commenting out the ACK lines as I2C will work without these
Nothing ever fails if you do not check the feedback to see if it actually worked!

The ACK line is used to make sure that the transfer went through and gives you a means to deal with it on the spot rather than wondering at the very end why things are not working and not knowing where in the long sequence of events the problem happened.

---55p
 
Last edited:
Top