1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

eeprom 24C64 read problem

Discussion in '8051/8951' started by ash20, Apr 22, 2012.

  1. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    no please not a new post... it is easier to look at this post only. :p

    and my circuit is attached.. View attachment 64085
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK
    Sorry I meant a new reply...in this post.

    Ok.. now I will investigate why its not working.... I'll do it tonight...
     
  3. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    ic is p89v51rd2
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK

    I've tested it on ISIS with an LCD and keypad and 64k eeprom...On P1.0 AND P1.1.. Its working absolutely fine..
    (Remember I'm using SDCC).
     
  6. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    can you message me your program?? i will see for any possible error in my code and then the last thing is to change the eeprom..
     
  7. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK
    No problem.. I'll give you the code AND the hex file tonight..
     
  8. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK
    Right... this is the C code and hex file ( this is the debug version )
     
  9. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
  10. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK
    You may be right about the eeprom being faulty...... However I usually receive 0xFF when I do a read from a faulty piece of code...

    Can you read the eepom directly from the programmer and use a hex file reader to see if the correct data is in the eeprom..

    The other thing you may try is to lengthen the write delay.... I have it at 5ms... check the datasheet of your 24c64... It may be a lot slower. Mine is a 400khz device.

    If you increase this delay to at lest 20ms and place two more nop()'s in the clock (clock stretching), it may help you..
     
  11. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    hahahahhahahah... ;) :D

    sire, my eeporm is WORKING now. Actually the PROBLEM was that the copper trace near the 8th pin was slightly uprooted and hence my eeprom was not geeting Vcc. :p

    so i thought to check the connections and saw the fault and immediately corrected it.. :)

    now i wrote data into the eeprom and switched the suply off and when i read, it gave correct data.. :rolleyes:

    i am sooooo happy... thanks a lot sir for helping this much...
     
    Last edited: May 13, 2012
  12. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    sir last thing that now comes to my mind is that can we erase the eeprom data externally or i would have to write all zeros in it to mark as empty??
     
  13. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK
    Have you got an eeprom burner? programmer?... If not, take the routine I posted a while ago and modify to suit.... It had sequential read / write.. You can write an entire page at a time...
     
  14. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    actually, i was asking that because now when i am saving any data, it always read back some data from previous saves...
    like first i saved 111111
    and it read it correctly
    now i saved 444444
    and it is showing 144444

    the reading and writing both starts from i=0, but still it is doing same...
     
  15. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK
    It seems as if the first write is failing.. go over your code and see if the writes are not too close together.... Also check the time from init to the first write is large enough.
     
  16. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    sir i checked it and thought to display each saved data and found that it just saves the value for i=0, after that it (dunno how) comes out of the loop. so it saves just one char .
    sorry the output i told above is as follows.

    first save 000000
    first read 000000

    second save 140412
    second read 100000

    this is my code (for saving date)

    void access_sys()
    {
    lcd_dataa("DATE: ");

    col1=col2=col3=col4=1;
    row2=row3=row4=0;
    while(col1==1 && col2==1 && col3==1 && col4==1);
    for(i=0;i<6;i++)
    {
    lcd_command(0x86+i);
    keypad(); // get date
    }
    ////date taking complete

    ////saving date
    lcd_command(0x01);
    lcd_ini();
    delay(2000);
    for(i=0;i<6;i++)
    {
    ak=date;
    Write(ak,i);
    lcd_data(ak); //here i thought to insert this to check on lcd whether
    //it is saving each value or not and found that it just
    //saves the first value and comes of this loop
    delay(1000);
    }
    /////date saving complete

    //rest part of program
    }
     
  17. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    since the loop is not working, i have thought of another alternative:

    ak=date[0];
    delay(100);
    Write(ak,0);

    ak=date[1];
    delay(100);
    Write(ak,1);

    ak=date[2];
    delay(100);
    Write(ak,2);

    ak=date[3];
    delay(100);
    Write(ak,3);

    ak=date[4];
    delay(100);
    Write(ak,4);

    ak=date[5];
    delay(100);
    Write(ak,5);

    but this makes the program lengthy as i will have to do the same for saving attendance ..

    so what should i do that makes the loop to completely write the date??
     
  18. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK
    Morning ash20..... if you look at this code.. tutorial 6_7 in my tutorials. It shows a sequential read / write as I said before. This allows multiple characters to be sent in one go.

    Just a thought here..... Are you using global variables.... "i" for instance?
     
  19. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    good morning sir. :) yupp i am using global one. because if i use local variable, it says some error related to recursiveness.

    and i made a simple program for writing some data sequentially, there it is saved correctly. but being a part of large program, the same part does not work. so i have tried the above method and it works. it might seem stupid, but earlier when my program was short, both lines of my lcd were working. now as my program goes large, only the first line is working. dunno why...

    so i dont think i should waste my time here... let it be as it is... i have altered some other codings to save this space.

    and for resetting the memory, i have planned to completely filled the used part of the eeprom with (space) ie decimal 32 :p so it looks as if it is blank. ha ha ha...

    and my (i feel) lastest problem (which if not corrected might not do any harm to me as it is out of my project limit) is that how can i show
    for roll number as 1 to 60... as i told earlier, i did from 1 to 9 and 10 separately. but how could i show it till 60 assuming number of students in class are 60.??
     
  20. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,163
    Likes:
    909
    Location:
    Rochdale UK
    Sorry I don't understand this comment... If you mean in relation to storing 10 to 60. Then I suggest that you store binary numbers and only convert them when displaying.
     
    Last edited: May 14, 2012
  21. ash20

    ash20 New Member

    Joined:
    Dec 14, 2010
    Messages:
    113
    Likes:
    0
    Location:
    India
    i want to show number from 1 to 60 on lcd and not just from 1 to 10. how to do that?
     

Share This Page