while(ack=3Di2c_write(0xA2)); Hi i have added the acknowledgement check as shown its not coming out of while loop, I have read the data sheet completely and followed it step by step. What can be the reason thet acknowledgement not coming 0. In circuit diagram came with my kit shows that adress pins of EEPROM A2,A1,A0 all are hard wired to ground, As the EEPROM is 4K, it takes 9bits to address. so A0 is no connect, Therefore taking device adress 1st 4bits 1010 + 0(A2)0(A1)+1(MSB of 9bit address)+0(write) which makes it 0xA2. Please help what can be probabale reason for ack. not coming 0 On Sat, Sep 11, 2010 at 2:55 AM, Barry Gershenfeld wrot= e: > > I am a new bie just learning to communicate to ext eeprom > > > You are also learning i2c. (Also, it's spelled "newbie"). > > > > output_high(PIN_B0); > > output_low(PIN_B1); > > > > I don't know what this is for, although I would guess you are looking for > this response on an oscilloscope. Note that it will be a fairly short > pulse. > > But this may well introduce another problem. I2C expects the pin to be > floating (output_float()) before starting a frame. This may not be a > problem because the i2c driver code may override the pin setting, but jus= t > to be sure, I would remove those two lines until you get i2c to work. > > > > > i2c_start(); > > i2c_write(0xA2); //write device address 1010 + a2 a1 +P0 + W > > > > At this point, you should change the line above to day, > f =3D i2c_write(0xA2); > > and then check the value of 'f'. It is the ACK, and it should be zero. = If > it is 1, you don't need to go any farther until you find out why. > > > > But no data is being read .. > > > > There are only two possible outcomes here, and "no data" isn't really > either > of them. Either > - the program hangs during read, or > - you read back all one's and the data appears to be 0xFF. > > 0xFF could be an unprogrammed chip, but is also what you get if the chip = is > ignoring you in the first place. Which really is "no data", but it's mor= e > accurate to say that you got back all 1's, because it's more precise and > eliminates the "hung" possibility. And by the way, it's what you will ge= t > if the "ACK" test (mentioned previously) fails. > > Barry > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 Thanks & Regards Nidhi Mittal Hada Scientific officer D Computer Division Bhabha Atomic Research Center Mumbai http://nidhi-searchingmyself.blogspot.com/ --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .