lpcware

Displaying text on LCD

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by amlwwalker on Sat Oct 26 10:42:30 MST 2013
Hi,

I am trying to get a font to display on my LCD.

I understand how it works in principle.
You get a font, then run it through an application to convert it to an array, for instance this is the letter A:

0x04, 0x00, //      #     
0x04, 0x00, //      #    
0x0A, 0x00, //     # #   
0x0A, 0x00, //     # #   
0x11, 0x00, //    #   #  
0x11, 0x00, //    #   #  
0x20, 0x80, //   #     # 
0x3F, 0x80, //   ####### 
0x40, 0x40, //  #       #
0x40, 0x40, //  #       #
0x80, 0x20, // #         #
0x80, 0x20, // #         #
0x00, 0x00, //           
0x00, 0x00, //           
0x00, 0x00, //           
0x00, 0x00, // 


its 11 pixels wide and 32 long.

I want to display it on my LCD which I can already display bitmaps on.

So my approach was
while(i < arrayLength) {
while (bitCounter < 8) {
if (letterArray << bitCounter != 0) {
setPixel(x, y, black);
else
setPixel(x,y, white);
bitCounter++;
x++;
if (x < 15) {
x = 0;
y++;
}
bitCounter = 0;
i++
}
}


However I just get a load of black pixels not resembling the letter A.
Has anyone done this?
Its also really slow to load.
I dont want to use a whole library for it, its quite a small thing.

Any ideas?
Tahnks
Alex

Outcomes