Alex_rcpilot
Member
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:
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:
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.
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.