Skip to content

We’ve Got Text!

March 9, 2014

I’v learned a lot about the LCD over the last couple of days. I found a bunch of C++ routines on this web site:
Very nice work and nicely generalized but I got tired of trying to dumb-it-down to C and my single LCD. In the end I just cribbed the font that you see below.
14-03-09 smallfont too

The LCD controller is an ILI9341 and it has many registers you can set and read. One of the neat things is that you can tell it how to map the LCD rows and columns and whether to write sequentially in the row direction or the column direction. For my purposes I’ve set it to have X=0,Y=0 in the top left. X goes up to 319 on the right and Y goes to 239 at the bottom; data written sequentially fills a row along the x axis then wraps around to the next Y.

You can also set a window where you want your data written: for example you can define a block (0,0) to (7,15) and data will be written to the leftmost 8 pixels of the top row then the leftmost 8 pixels of the second row and so on. To write one of the letters of the font you can just sequentially write the 8*16 pixels to fill that block then move on to (8,16)-(23,16) when you’ve done that 40 times you can move on to (0,16)-(7,31) and so on.

At the moment writing the text is very slow because the pixels that make up each character are stored 8 to a byte times 16 bytes so for each character for each of 16 bytes you have to shift and examine the top bit, output either two bytes for a coloured pixel or two 0’s for a blank one. It’s actually taking about .6 sec for 10 characters so 15 cps – teletype speed! I’m confident i can improve that. Using fewer bits is an obvious move but it would make my tiny text even tinier.

The characters are tiny by the way because the LCD has a fairly high DPI. The screen is about 2″ across so it’s 160 dots per inch and even 16 pixel high characters are pretty small.

The other neat thing I envision is that I can stream a bitmap to it fairly quickly by defining a window the size of the bitmap and streaming the pixels to it.

I have a specific target in mind for my browser-to-be and both text and bitmap image are critical.


From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: