Memory page boundarys and programming


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156

    Question Memory page boundarys and programming

    I recently chose to use a 24LC512 in a project, and raced ahead and implemented some test code without paying enough attention to the datasheet. Now I'm finding that things need to be largely rewritten because of "paging boundary" issues, and PBP's string writes.

    I'm sure there must be a logical way to deal with this issue, but don't see much posted about it. So the question is... How would a good programmer deal with page boundarys (in this case 128-byte page boundarys) in his/her program? How would you (most painlessly) keep track of these boundarys, and be able to do "string writes" as effortlessly as possible? i.e.

    I2CWRITE SDA,SCL,$A0,MEM,[STR A\25]

    Are there any examples or posts with an example of a decent way to handle this issue?

    Thanks for your insight.

  2. #2
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    It depends on the size of each write. If you are writing small chunks, like 4 bytes, then you can easily make sure the start and end do not end up in different pages by dividing the start & end locations by 128 and see if they are the same. If you use integers, the remainders should truncate rather than round so you won't need to use mod. Then, if they do, to simplify it just write the whole thing one byte at a time, waiting for the write time between bytes.

    read the d/s on polling for write completion. Usually a write is about 1/10 or less than the "worst case" time spec'd out.

  3. #3
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Wink

    Thanks very much. The 'string writes' did save me alot of time... the ap is for a video remote & the users are very concious of switching time, but for the few places I do odd/short reads and writes, I can afford to do it byte-per-byte.

    Thanks for your help!

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