+ Reply to Thread
Results 1 to 3 of 3

Thread: LCD display "previous page" problem

  1. #1
    Alex_rcpilot Newbie
    Join Date
    Jan 2004
    Location
    Beijing, China
    Posts
    235

    Default LCD display "previous page" problem

    Hi guys.I'm working on a graphic dot matirx LCD with 128*64 pixels.I've successfully managed displaying text(*.txt file stored in a SanDisk SD card) in consecutive pages on it.It's interesting and fun.But I figured it much more difficult to turn back to the previous pages because of 'Enter' marks.

    I'm putting an example here to make this plain.Say there's a paragraph below:



    Reset Circuit
    When the /RES input falls to “L”, these LSI reenter their default state. The default settings are
    shown below:
    1. Display OFF
    2. Normal display



    And it looks like this on my LCD:

    • ----------------
      Reset Circuit
      When the /RES in Page 1
      put falls to “L
      ”, these LSI re
      ----------------
      enter their defa
      ult state. The d Page 2
      efault settings
      are
      ----------------
      shown below:
      1. Display OFF Page 3
      2. Normal displa
      y
      ----------------


    Each ASCII character takes up 8*16 dots.And when it comes to 0x0D 0x0A('Enter'mark),spaces are filled all the way to the end of current line.Sometimes wide characters are displayed(for example Chinese characters).Each of such character takes up 2 bytes as well as 16*16 dots.Theoretically it does the same with 2 ASCII characters both in code size and geometrical size.But when there's only the last 8*16 room left for this character,we can't split it up.An 8*16 space mark is placed there and the wide character is moved to the beginning of the next line.Due to such circumstances,a page of text isn't always the content of 64 bytes,but less.This gives us a variable byte offset value for each page.

    Assume I stated from the first page.And when I turn to the second page,the microcontroller simply uses the byte address offset value calculated while the first page was displayed.

    Now I've gone all the way down to page 3,and I want to turn back to page 2.I expect the page look the same way it showed up just now,but how?

    looking backward in the txt file.I found 0x0A first,obviously it's the second half of the 'Enter' mark.So I pass by the succeeding 0x0D,finding 64 ASCII codes 'era sgnittes tluafed ehT .etats tluafed rieht retnere ISL eseht '

    Eventually the regenerated page 2 looks like this:

    • ----------------
      these LSI reent
      er their default
      state. The defa
      ult settings are
      ----------------


    And it no longer looks the way it used to be.

    I notice mobile devices like cellphones browse texts pretty easily.You turn back and find the identical page you read just seconds ago.I don't know how they did that without memorizing offsets of each page.Could anyone offer me a clue please?Thank you.
    Regards, Alex


  2. #2
    Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent
    Join Date
    Mar 2005
    Location
    Brisbane Australia
    Posts
    6,805

    Default

    I think the only way to do this is to start from the beginning of the text and work forward. It should be as simple as counting 64 characters with the exception of characters 0D and 0A. I'd ignore 0D and treat 0A as a new line. So, if an 0A is met then count = count and 0f0h + 16 should work.

    If you also wanted to take care of chars that are double width then testing the DC bit after adding 1 twice would tell you whether to add another 1.

    Mike.

  3. #3
    Alex_rcpilot Newbie
    Join Date
    Jan 2004
    Location
    Beijing, China
    Posts
    235

    Default

    Quote Originally Posted by Pommie
    I think the only way to do this is to start from the beginning of the text and work forward. It should be as simple as counting 64 characters with the exception of characters 0D and 0A. I'd ignore 0D and treat 0A as a new line. So, if an 0A is met then count = count and 0f0h + 16 should work.

    If you also wanted to take care of chars that are double width then testing the DC bit after adding 1 twice would tell you whether to add another 1.

    Mike.
    Thanks for your suggestions.Now it seems to be the only way to figure out what the 'previous' page looks like.Not really bad though.At least I don't need to get the dot graphic information and transfer it onto the LCD.Such calculation should be pretty fast.I'll try it and tell you guys the result later.
    Regards, Alex

+ Reply to Thread

Tags for this Thread