Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2C interfacing problem with Eprom 24C512

Status
Not open for further replies.

joydeepsarkar87

Member level 2
Joined
Jun 29, 2010
Messages
47
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Location
India
Activity points
1,563
I am using PIC 16f887A and tryign to store a value in Eprom 24C512. I code that I am using is pretty standard and the code compiles without any error in MPLAB. The write function works out fine but when I try to read the data back from the eprom address i always get the value 0xFF. Any suggestion will be great help

Thanks in advance
 

The write function works out fine but when I try to read the data back from the eprom address i always get the value 0xFF.

from that, how did you conclude that the write function works out fine?
 

I think the write function works out fine coz i do get the acknowledgment back from the eprom..
 

first of all, there can be more than 1 acknowledgement from the slave in a write operation.

2ndly, slave acknowledgement only means the complete of a write-operation. how do you know the right content is being written to the right address?
 

please post all your information (schematics, code, test results) otherway there is little help we can provide...

i think... maybe you are forgetting or messing with the i2c packet. most examples use small i2c memories (24c01 to 24c16) which only uses 3 bytes to write a random position (i2c_addr , mem_adr, mem_dat) all enclosed in (i2c_start and i2c_stop) and the three having an acknowledge... after issuing a simple i2c memory write, you must wait something like 10ms to get the data written... don't read the data before! (mostly the memory will report NAK until it finnished the process)

on higher capacity memories (like your 24c512) you need a 4 byte i2c packet (i2c_addr, mem_addrH, mem_addrL, mem_dat) so if you issue a 3 byte packet you will get all acknowledges(up to set address) but not making and actual 'write' (no data sended)...

the same to read a random position... the address setting follows the same logic (2 byte on first example and 3 bytes on last example)...
 
  • Like
Reactions: RajS

    joydeepsarkar87

    Points: 2
    Helpful Answer Positive Rating

    RajS

    Points: 2
    Helpful Answer Positive Rating
hi,i think you should take an oscillograph to check whether your timing is correct.and you can't judge your writiing function with an ack flag.
 

Iam having same problem with at24c512 .I have used a delay of 10ms after write but Iam getting 0xff after reading the data...please reply
 

Could you please send me the code that you have written for this... It may be useful for my project too..... Its a main part of my project....:???:
 

did u simulated it on ISIS[proteus]
i think that can give u a very deep inside
you can really see if data is being written on the EEPROM

a better way paste your code
 

The thing is that i ma having a great problem in knowing how to give and read the address of an EEPROM ( AT24C512) ..... I am going to use only one EEPROM and one slave & master ... please help with code......

---------- Post added at 13:48 ---------- Previous post was at 13:26 ----------

The thing is that i am having a great problem in knowing how to give and read the address of an EEPROM ( AT24C512) ..... I am going to use only one EEPROM and one slave & master ... please help with code......

I thought of interfacing it with Pic16F877..............

---------- Post added at 13:48 ---------- Previous post was at 13:48 ----------

I am using HI-Tech C Compiler....
 

Can anyone help me in this... Please.............
 

OK I have a working code for Hi-Tech C but it is for 18F452 i convert it for 877 then i will send it to you
 
  • Like
Reactions: RajS

    RajS

    Points: 2
    Helpful Answer Positive Rating
Thanks a lot... I am also working with HI TECH C COMPILER...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top