Showing posts with label fonts. Show all posts
Showing posts with label fonts. Show all posts
0

Nokia 6610 menus

Posted by Chris on Thursday, July 16, 2009 in , , ,
There have been some exciting developments with our Score Sure Golf Pro game scoring device recently: namely that we've managed to get a full-colour Nokia 6610 128x128 display working with a PIC18F2455!

What does that mean?
For our ScoreSure range of devices, it means the hunt for a stable, decent screen is finally over! It also means the whole thing will fit into a much smaller enclosure, making it much more "pocket-friendly" and therefore more likely to gain acceptance. There were concerns, after seeing the original device actually working on a 128x64 mono glcd, that it might be getting a bit big and bulky. Of course, it also means we now how a full-colour display (although it'll still mainly be used as a mono device, due to memory/storage constraints!) but the odd splash of colour here and there won't go amiss!

It also means that there's now a library of PIC-based functions available for drawing bitmaps, writing text/displaying fonts AND creating menus. Readers of earlier posts will see that we've already had monochrome bitmaps displayed - the bug that stopped rending the image properly came from the VB app used to convert the image into a sequence of bytes and NOT the PIC rendering code (so the list of bytes you see in that example cause a white line to appear under the golfers feet).



Using the work done with an earlier GLCD the Nokia 6610 can also display strings of text. Unlike mono GLCD displays, where a vertical "slice" of 8 pixels for each character is sent in a single byte, the Nokia 6610 uses a single byte PER pixel. So that means breaking each character down into 5 vertical slices, then looping through each byte, and checking the status of each bit in the byte.
If the bit is set, the value for the "foreground" colour is sent - if the bit is not set or zero, the value for the background colour is sent to the display.
Thus strings of text are always drawn inside a box and you need to match the box background colour with the background colour of the display to avoid having big stripes of colour all over the screen.

To make our display more readable on the Nokia 6610, the fonts have been redesigned. Each is still 5x8 pixels, but this time a single pixel spacing remains at the bottom of each character. The character height has also increased by a pixel.
Below is a screenshot of how the characters were drawn using a homemade VB app to convert pixels into byte-slices:



The fact that strings are drawn inside boxes can be exploited for drawing menus.
By setting the background colour to one different to the colour of the display, when a string of text is drawn, it appears to be inside a coloured box. It is easy to imagine that a simple "if" statement can be used when rendering a menu to decide whether to use the default background colour (black/white) or the highlight colour (red) when drawing a string of text on the screen.
When the menu bar needs to be moved, the string of text that is highlighted is simply drawn again, this time using the default background colour.

The characters were redrawn and deliberately centred vertically inside each 5x8 grid (as best could be achieved) so that when drawn using a different background colour, they did not appear off-centre.

Here's a screenshot of the output acheived using these fonts:


0

Interfacing with a 122x32 GLCD

Posted by Chris on Friday, June 12, 2009 in , ,
There are loads of graphical LCDs out there - and a whole range of different sizes, prices, functionality and more. Interfacing with each one is different every time, so finding the right display is a fine balancing act between ease-of-use, number-of-pins and cost.

While I'm waiting for my 122x32 GLCD to be delivered (only 99p each from eBay!) I've been working on how to actually display stuff with them! The datasheet(s) are quite vague, but it is possible to glean the basics from them:

The actual display uses TWO driver chips and the data you send to from the microchip is presented to both of them - you need to set a pin to tell the display which driver chip (master or slave) the instruction is intended for. It seems that you do this by making pin E1 high for the master driver (i.e. the top half of the display) or driving E2 high for the slave (the bottom half of the display).

Pin numberSymbolLevelDescription
1Vdd3VSupply voltage
2Vss0VGround reference
3VlcdvariesPower for LCD display
4resetLow-to-HighReset the system
5E1HRead/write enable (master)
6E2HRead/write enable (slave)
7R/WH/LH=read, L=write
8A0H/LH=data, L=command
9DB00/1Data bit 0
10DB10/1Data bit 1
11DB20/1Data bit 2
12DB30/1Data bit 3
13DB40/1Data bit 4
14DB50/1Data bit 5
15DB60/1Data bit 6
16DB70/1Data bit 7
17BLA3VBack light anode
18BLC0VBack light cathode




The SED1520 driver chips do not support built-in characters/fonts, so to write characters on the display, it seems that you must create your own bitmap fonts and send the data across from the microchip, to display each miniature bitmap, one column at a time (since the data is transferred vertically on the data bus).

This means that a complete font set has to be designed and encoded.
I made my own font set using nothing more technical than a sheet of paper, a biro and the side of a CD case for drawing some straight lines! I made each font 8x5 pixels (a pretty standard size) but allowed a pixels space around each letter, so they are slightly smaller than most LCD fonts.

I then transferred these fonts into a custom-built VB application so that each character in the font set could be represented by 5 bytes of data. Now, when a character needs to be sent to the gLCD, the "row" (page) and "column" values can be set, and the data sent as a sequence of 5 bytes, to draw the letter as a bitmap on the display

whos.amung.us

Copyright © 2009 .Nerd Club All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive Supported by Blogger Templates.