24LC256 Page problem


Closed Thread
Results 1 to 3 of 3
  1. #1

    Cool 24LC256 Page problem

    Hi!!!
    I am having this problem: my memory writes and reads fine until it has to write in a change page byte (around 64 bytes). The thing here is that my "data packet" is 24 bytes and while writing through 64 bytes I get wrong bytes.

    this is my code for writing:
    **********************************************
    **********************************************
    Writemem:
    lcdout "Writing"
    I2Cwrite SDAmem,SCLmem,$A0,addr,[reciboH, reciboL.byte1, reciboL.Byte0]
    pause 10
    addr= addr+3
    I2Cwrite SDAmem,SCLmem,$A0,addr,[Numeromarc[CabRx*10],Numeromarc[CabRx*10+1],Numeromarc[CabRx*10+2],Numeromarc[CabRx*10+3],Numeromarc[CabRx*10+4],Numeromarc[CabRx*10+5],Numeromarc[CabRx*10+6],Numeromarc[CabRx*10+7]_
    ,Numeromarc[CabRx*10+8],Numeromarc[CabRx*10+9]]
    pause 10
    addr= addr+10
    I2Cwrite SDAmem,SCLmem,$A0,addr,[RTCDay, RTCMonth, RTCYear, Hourinicio[Cabrx], minsinicio[Cabrx], Secsinicio[Cabrx]]
    pause 10
    addr=addr+6
    I2Cwrite SDAmem,SCLmem,$A0,addr,[hourscall[Cabrx],minscall[Cabrx],secscall[Cabrx]]
    pause 10
    addr=addr+3
    I2Cwrite SDAmem,SCLmem,$A0,addr,[TotalActCab [Cabrx]]
    pause 10
    addr= addr+2

    write regsmemHm, addr.byte1 'proxima dirección de mem a escribir
    write regsmemLm, addr.byte0

    '**************AUMENTAR NUMRECIBO
    if reciboL = 65535 then
    reciboH=reciboH+1
    reciboL=0
    else
    reciboL=reciboL+1
    endif

    write reciboHm, reciboH
    write reciboLlowm, reciboL.byte0
    write reciboLHighm, reciboL.byte1
    return
    **********************************************
    **********************************************

    What should I do? do i have to write one byte at the time?

    Thanks in advance!!

    DAVIDCAS

  2. #2
    JosueCas's Avatar
    JosueCas Guest


    Did you find this post helpful? Yes | No

    Lightbulb My own solution, waiting for others solution

    Ok so i read back everything!, the datasheet of the EEPROM memory clearly states that you can't write over a page cross(every 64 bytes).

    My ideas:

    Solution number one: you can write one byte at the time, but this gives a 240 ms delay just for writing which is bad!!! bad!!!.

    Solution number two: find the "less common denominator" (not sure off the name as i speak spanish and i hadnt used this concept since i was like two)
    So if my packet is 24 bytes and the page is 64 bytes i can write 8 bytes packages being sure that i will never write across page boundaries. So now my delay will be of 30 ms instead of 240 ms.

    This is not the perfect solution, maybe the next generation of the I2C command can control this automatically.

    Thanks for any opinion,


    DAVIDCAS

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    How tight are you for space in your EEPROM? If it's tight, oversize your EEPROM...

    Allocate only two data packets per page... the first starts at Byte 0 and goes to byte 23, the second starts at byte 32 and goes to byte 55. This technically wastes 8 bytes at the end of each packet (wasting 16 bytes per page) but it does give two advantages...

    1. You have a 10mS total write time.

    2. It gives expansion for 'future creep' where at some point in time your data packet grows beyond 24 bytes, you can then incorporate such expansion without a major rewrite of your code.

Similar Threads

  1. Replies: 5
    Last Post: - 29th May 2008, 18:03
  2. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  3. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31
  4. Page write (I2CWRITE)
    By Tomas in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th April 2004, 00:05
  5. Writing / Reading EEPROM 24LC256 Problem
    By schmoddel in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th February 2004, 18:55

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts