• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

How to Convert Bitmap image to CFAG12864B-TMI-V graphic LCD

xIceman

New member
I was wondering where I could possibly find a utility that can convert a bitmap image to code that would disply on a CFAG12864B-TMI-V.

My interface consists of a Dios microcontroller and the CFAG12864B-TMI-V. Basically, I just need the utility to mark which pixels on the screen I need to hit so that I can incorporate that into my code.

Thanks for the help.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

xIceman

New member
Thanks.

I seem to be a bit confused.

I downloaded a similar 'Bitmap to ASM' converter. I have taken a 128x64 bitmap and converted it. The text file is as follows:

db 003h,001h,000h,000h,000h,000h,040h,0A0h,040h,0A0h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,00Ch,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,0A8h,000h,0A0h,000h,0A0h,000h,080h,000h,000h,000h,000h,001h,003h
db 000h,000h,000h,000h,054h,0AAh,015h,00Ah,001h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,080h,000h,000h
db 000h,0A8h,000h,008h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 080h,040h,020h,010h,010h,008h,008h,008h,008h,008h,008h,008h,008h,008h,008h,008h
db 008h,008h,008h,008h,088h,088h,008h,008h,008h,010h,010h,020h,040h,080h,000h,000h
db 000h,000h,000h,002h,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,00Ah,000h,000h
db 000h,00Ah,000h,000h,000h,000h,000h,000h,000h,000h,000h,0A0h,000h,000h,000h,0FEh
db 001h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,0E0h,0FEh,0FFh,0FFh,0FFh,0FFh,0FEh,0E0h,000h,000h,000h,000h,001h,0FEh,000h
db 000h,000h,000h,000h,000h,02Ah,000h,02Ah,000h,00Ah,000h,002h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,00Ah,000h,000h,000h,0FFh
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,0F0h,0FEh,0FFh,0FEh,0F0h,000h,000h
db 000h,07Fh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,07Fh,000h,000h,000h,000h,000h,0FFh,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,0FFh
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,0FFh,0FFh,0FFh,0FFh,0FFh,000h,000h
db 000h,000h,007h,00Fh,01Fh,01Fh,00Fh,007h,000h,000h,000h,000h,000h,000h,0FFh,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,0A8h,000h,0A8h,000h,0A8h,000h,0A8h,000h,0AAh,000h,0AAh,000h,080h,000h,0FFh
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,0FFh,0FFh,0FFh,0FFh,0FFh,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,0FFh,000h
db 000h,000h,000h,000h,000h,000h,000h,080h,000h,080h,000h,080h,000h,080h,000h,080h
db 000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0FFh
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,0FFh,0FFh,0FFh,0FFh,0FFh,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,0FFh,000h
db 000h,000h,000h,000h,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh
db 000h,002h,000h,002h,000h,002h,000h,002h,000h,002h,000h,002h,000h,002h,000h,0FFh
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,0FFh,0FFh,0FFh,0FFh,0FFh,000h,000h
db 000h,000h,000h,000h,0C0h,0E0h,0E0h,0C0h,000h,000h,000h,000h,000h,000h,0FFh,000h
db 000h,000h,000h,000h,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,080h,000h,000h,000h,000h,000h,0FFh
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,003h,01Fh,03Fh,01Fh,003h,000h,000h
db 000h,000h,000h,0FCh,0FFh,0FFh,0FFh,0FFh,0FEh,000h,000h,000h,000h,000h,0FFh,000h
db 000h,000h,000h,000h,000h,0AAh,040h,0AAh,050h,0AAh,050h,0AAh,050h,0AAh,050h,0AAh
db 000h,000h,000h,080h,000h,0A0h,000h,0A8h,000h,002h,000h,000h,000h,000h,000h,0FFh
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,07Fh,0FFh,0FFh,0FFh,0FFh,07Fh,000h,000h,000h,000h,000h,0FFh,000h
db 000h,000h,000h,000h,000h,000h,0D5h,0AAh,0D5h,0AAh,0F5h,0AAh,0F5h,0AAh,0F5h,0AAh
db 000h,0A8h,000h,0AAh,000h,0AAh,000h,0AAh,000h,000h,000h,000h,000h,000h,000h,03Fh
db 0C0h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,007h,00Fh,00Fh,007h,000h,000h,000h,000h,000h,0C0h,03Fh,000h
db 000h,000h,000h,000h,000h,0FAh,0FFh,0FAh,0FFh,0FAh,0FFh,0FAh,0FFh,0FAh,0FFh,0FAh
db 000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,001h,002h,004h,004h,008h,008h,008h,008h,008h,008h,008h,008h,008h,008h,008h
db 008h,008h,008h,008h,008h,008h,008h,008h,008h,004h,004h,002h,001h,000h,000h,000h
db 000h,000h,000h,000h,0FEh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh
db 000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 080h,0E0h,0F8h,0FEh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh
db 000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0A0h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,0F0h,0F8h,0FCh
db 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh
db 0C0h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,000h,0AAh,050h,0A0h,000h,080h
db 000h,080h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,080h
db 0C0h,0C0h,0E0h,0E0h,0E0h,0E0h,0E0h,0E4h,0E4h,0E3h,0E0h,0E0h,0E0h,0FFh,0FFh,0FFh
db 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh

I can't seem to 'crack' this code. Basically, for the Dios microcontroller, I need to set each pixel in the screen with an 'x,y' coordinate system. Basically, for row 1, pixel 5, I use 1,5.

I assume the text file conversion is in Hex, but I can't seem to figure it out yet how I can apply it to my needs.

Thanks for the help.
 

CF Tech

Administrator
To do a pixel-at-a-time approach, it will probably be painfully slow. You would have to call the Dios' "GLCDsetpixel" routine 8192 times (128 * 64).

A better approach would be to use the "GLCDsetpos" and "GLCDwritestrip". Then you would only have to call it 1024 times, and it would accept the data like you have shown or the data in our test prog.

Basically your code should look like this:
Code:
const unsigned char cfag12864b[8][128]=
   {{0xF0,0xFC,0x0E,0x07,0x03,0x03,0x03,0x07,
     0x0E,0x0C,0x00,0xFF,0xFF,0x83,0x83,0x83,
     0x83,0x83,0xC7,0xFE,0x7C,0x00,0x03,0x0F,
     0x3C,0xF0,0xC0,0xC0,0xF0,0x3C,0x0F,0x03,
     0x00,0x3C,0x7E,0xE7,0xC3,0xC3,0xC3,0xC3,
     0xC7,0x8E,0x0C,0x00,0x03,0x03,0x03,0xFF,
     0xFF,0x03,0x03,0x03,0x00,0x00,0xE0,0xFC,
     0x1F,0x1F,0xFC,0xE0,0x00,0x00,0x00,0x00,
     0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,
     0x00,0x00,0x00,0x00,0xFF,0xFF,0xC3,0xC3,
     0xC3,0xC3,0xC3,0xC3,0x03,0x03,0xF0,0xFC,
     0x0E,0x07,0x03,0x03,0x07,0x0E,0xFC,0xF0,
     0x00,0x00,0xFF,0xFF,0x0E,0x38,0xF0,0xC0,
     0x00,0x00,0xFF,0xFF,0x00,0x03,0x03,0x03,
     0xFF,0xFF,0x03,0x03,0x03,0x00,0x03,0x03,
     0x03,0x03,0xC3,0xE3,0x33,0x1F,0x0F,0x03},
    {0x03,0x0F,0x1C,0x38,0x30,0x30,0x30,0x38,
     0x1C,0x0C,0x00,0x3F,0x3F,0x01,0x01,0x03,
     0x07,0x0F,0x1D,0x38,0x30,0x00,0x00,0x00,
     0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,
     0x00,0x0C,0x1C,0x38,0x30,0x30,0x30,0x30,
     0x39,0x1F,0x0F,0x00,0x00,0x00,0x00,0x3F,
     0x3F,0x00,0x00,0x00,0x38,0x3F,0x07,0x06,
     0x06,0x06,0x06,0x07,0x3F,0x38,0x00,0x00,
     0x3F,0x3F,0x30,0x30,0x30,0x30,0x30,0x30,
     0x30,0x30,0x00,0x00,0x3F,0x3F,0x00,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,
     0x1C,0x38,0x30,0x30,0x38,0x1C,0x0F,0x03,
     0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x03,
     0x07,0x1C,0x3F,0x3F,0x00,0x00,0x00,0x00,
     0x3F,0x3F,0x00,0x00,0x00,0x00,0x30,0x3C,
     0x3E,0x33,0x31,0x30,0x30,0x30,0x30,0x30},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,
     0x0C,0x0C,0x1C,0x38,0x70,0x20,0x00,0x00,
     0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0C,0x0C,
     0x1C,0x38,0x70,0xE0,0xC0,0x80,0x00,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x00,0x7C,0xFE,0x83,0x01,0x01,0xC7,0xC6,
     0x00,0x01,0xFF,0xFF,0x11,0x11,0x3B,0x07,
     0x00,0xFC,0xFE,0x23,0x23,0xFE,0xFC,0x00,
     0x00,0x7C,0xFE,0x83,0x01,0x21,0xE7,0xE6,
     0x00,0x04,0x04,0xFE,0xFF,0x00,0x00,0x00,
     0x00,0x86,0xC7,0x61,0x31,0x9F,0x8E,0x00,
     0x00,0xEE,0xFF,0x19,0x31,0xFF,0xEE,0x00,
     0x00,0xFC,0xFE,0x13,0x11,0xF1,0xE0,0x00,
     0x00,0x30,0x38,0x2C,0x26,0xFF,0xFF,0x20,
     0x00,0x01,0xFF,0xFF,0x11,0x11,0xFF,0xEE},
    {0x80,0x80,0x80,0x80,0x80,0x80,0x98,0x9C,
     0x9E,0x9F,0x9F,0x9F,0x9F,0x80,0x80,0x80,
     0x80,0x00,0x00,0x00,0xF8,0xFC,0xFE,0xFF,
     0xFF,0xFF,0xFF,0x00,0x00,0x80,0x80,0x80,
     0x80,0x80,0x80,0x9F,0x9F,0x9F,0x9F,0x9E,
     0x9C,0x98,0x80,0x80,0x80,0x80,0x80,0x80,
     0x00,0x80,0x00,0x01,0x81,0x01,0x01,0x80,
     0x00,0x01,0x81,0x81,0x81,0x80,0x00,0x00,
     0x80,0x01,0x01,0x80,0x00,0x01,0x81,0x00,
     0x00,0x80,0x00,0x01,0x81,0x01,0x01,0x81,
     0x00,0x01,0x81,0x01,0x01,0x81,0x01,0x00,
     0x80,0x01,0x01,0x81,0xC1,0xE1,0xF1,0x38,
     0x1C,0x8E,0x07,0x07,0x8F,0x1D,0x38,0xF0,
     0xE0,0x80,0x81,0x01,0x01,0x81,0x00,0x00,
     0x80,0x00,0x00,0x80,0x01,0x01,0x81,0x01,
     0x00,0x81,0x01,0x01,0x81,0x01,0x01,0x80},
    {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
     0xFF,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
     0xFF,0xFF,0xFF,0x00,0x00,0x99,0x99,0x99,
     0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,
     0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,
     0x00,0xC0,0xE0,0xB0,0xB8,0x9C,0x8E,0x86,
     0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x87,
     0x8E,0x9C,0xB8,0xF0,0xE0,0x80,0x80,0x80,
     0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
     0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
     0xC0,0xF0,0xBC,0x9F,0x87,0x81,0x80,0x80,
     0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
     0x83,0x8F,0xBE,0xF8,0xE0,0x80,0x80,0x80,
     0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
     0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80},
    {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
     0xFF,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
     0xFF,0xFF,0xFF,0x00,0x00,0x99,0x99,0x99,
     0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,
     0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,
     0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
     0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
     0x01,0x01,0x01,0x01,0x01,0x03,0x0F,0x1D,
     0x79,0xF1,0xC1,0x81,0x01,0x01,0x01,0x01,
     0x01,0x01,0x81,0xC1,0xE1,0x79,0x1D,0x0F,
     0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
     0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
     0x01,0x01,0x01,0x01,0x07,0x1F,0x7D,0xF1,
     0xC1,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
     0x01,0x01,0x01,0x01,0xC1,0xF1,0x7F,0x1F},
    {0x01,0x01,0x01,0x01,0x01,0x01,0x19,0x39,
     0x79,0xF9,0xF9,0xF9,0xF9,0x01,0x01,0x01,
     0x01,0x00,0x00,0x00,0x1F,0x3F,0x7F,0xFF,
     0xFF,0xFF,0xFF,0x00,0x00,0x01,0x01,0x01,
     0x01,0x01,0x01,0xF9,0xF9,0xF9,0xF9,0x79,
     0x39,0x19,0x01,0x01,0x01,0x01,0x01,0x01,
     0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,
     0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,
     0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,
     0x00,0x01,0x01,0x01,0x03,0x07,0x06,0x07,
     0x06,0x07,0x03,0x01,0x00,0x01,0x00,0x00,
     0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,
     0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,
     0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x03,
     0x07,0x1E,0x38,0xF1,0xC0,0x80,0x81,0x80,
     0xC0,0xF1,0x78,0x1F,0x07,0x01,0x00,0x01},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x00,0x00,0x01,0x03,0x07,0x0E,0x1C,0x38,
     0x30,0x30,0x38,0x1C,0x0E,0x04,0x00,0x00,
     0x01,0x03,0x07,0x0E,0x1C,0x38,0x30,0x30,
     0x38,0x1C,0x0E,0x07,0x03,0x01,0x00,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x00,0x4C,0x92,0x92,0x92,0x64,0x00,0xFE,
     0x04,0x08,0x04,0xFE,0x00,0xFC,0x22,0x22,
     0x22,0xFC,0x00,0xFE,0x80,0x80,0x80,0x80,
     0x00,0xFE,0x80,0x80,0x80,0x80,0x00,0x00,
     0x00,0x00,0x00,0x78,0x94,0x92,0x92,0x60,
     0x00,0xD8,0x20,0x20,0xD8,0x00,0x00,0x6C,
     0x92,0x92,0x92,0x6C,0x00,0x00,0x00,0x00,
     0x00,0x02,0x02,0xFE,0x02,0x02,0x00,0xFE,
     0x92,0x92,0x92,0x82,0x01,0xC7,0x29,0x11,
     0x29,0xC6,0x00,0x02,0x02,0xFE,0x02,0x02}};

void Show_Bitmap(void) 
  {
  int
    line;
  int
    pos;
  for(line=0;line<=7;line++)
    {
    //Set page, line and pos
    GLCDsetpos(1,line,0);
    for(pos=0;pos<=63;pos++)
      {
      //Left page
      GLCDwritestrip(1,cfag12864b[line][pos]);
      //Right page
      GLCDwritestrip(2,cfag12864b[line][pos+64]);
      }
    }
  }
Ref: http://www.kronosrobotics.com/Anotes/AN164 GraphicLCD.pdf
 
Top