Graphic LCD ST7565

Hi all,

I am having a bit of bother getting a B&W logo, which I wish to display on an ST7565.

I have tried to convert the .BMP file I have with BMP2GLCD, but whatever command-line parameters I use, the result is always a '.h' file of arround 74KBytes ...

Here are the first few lines of the generated header file.

//---------------------------------------------------------------------------
//    A header datafile for glcd bitmap created with bmp2glcd by S.Varjo 
//---------------------------------------------------------------------------
#ifndef _MID_ELEC_MONO_GLCD_H 
#define _MID_ELEC_MONO_GLCD_H 

#define MID_ELEC_MONO_GLCD_HEIGHT 266 
#define MID_ELEC_MONO_GLCD_WIDTH  361 
static unsigned char __attribute__ ((progmem)) mid_elec_mono_glcd_bmp[]={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0

any ideas ?

I do not know about BMP2GLCD but I use Gimp and some simple text substitution to generate such files. Gimp can save “.h” files :slight_smile:

Udo

the result is always a '.h' file of arround 74KBytes

What were you expecting? If you place the .h file in the same folder as your sketch, the next time the Arduino interface powers up it will be there as a tab in the window and automatically included in your sketch when you compile it.

Thanks for the replies ...

I was expecting the .h file, but assumed that the command-line sizes for width and height would effect the values as shown in the .h file, and the size of the attendant char array.

What is shown in the snippet above - width 361 and height 266 don't seem to relate to my inputs of 128 and 64. I have tried with diffrent parameters ( for e.g. 16 x 16 for a really small graphic), but still get a 74 Kilo-Byte file.

The ram set aside for the LCD is 1KByte for the 128 x 64 Bit display - there is something I am missing.

I shall google for gimp, and see what comes up

Thanks, Udo & Mike

At least you can use Gimp to scale down the size :)

Udo

Yup, starting the learning-curve now .....

OK, so here is where I am at now...

I have scaled the graphic I want with gimp, and also used mspaint.

Next, I converted it with bmp2glcd - gives the expected .h file, which when included in my sketch, compiles and runs BUT the image on the display is as below, - really garbled

I know the hardware is correct, since the "adafruit industries" graphic comes out ok.

If I shuffle the 8 blocks of data produced by bmp2glcd into a diffrent order - I get a 'mirror' image, upside down of what I want

Any Ideas ?

TIA, Charlied

also - how does one post pictures - I can't find any 'browse' button ...

If it is upside down, why not mirror it with GIMP beforehand?

Udo

If you can visualise 8 equal bands, running across the display (L to R), then each one is upside-down. If I take the bottom one to the top, and the second-from-bottom to second from top, etc - then the image is correct, but inverted. - a few pictures will explain MUCH better - how do I post pictures ?

You need to put them somewhere and then you have to put a link to them. There is no means to upload pictures. Anyway I got you issue.

You have several ways to deal with this:

1) Adapt your driver 2) Reverse the bit order in the bytes at runtime 3) Reverse the bit order in the bytes at compile time 4) Use a generator that will deliver the proper bit sequences.

Probably (2) is easiest to implement for a beginner. (3) or (4) would be better though.

Udo

Thanks Udo - I will try find a working generator. Whoever produced the 'Adafruit Industries' logo for the GLCD Lib must have something.

OK, just for completeness’ sakes - i have got the display how I want it :slight_smile:

I had to invert each byte of the 1024 byte array - for example, a value of 0xf8 becomes 0x1f, or 0x7c becomes 0x3e, etcetra, 1024 times.

Cheers, Charlie

Congratulations. Just for completeness sake, did you use (2) or did you use (3).

Udo

Nah - used Wordpad !! tedious, but worked.

Ouch. I would have used a python script or perl oder sed. Wordpad --> that hurts. Anyway, success is success ;)

I wrote a python plug-in for the GIMP which saves a greyscale image to a C header file with 1 or 4 bits-per-pixel. It's a simple script and Python is easy to pick up, you can easily modify it to generate whatever array format you want.

It's posted on the Stellaris forums:

Google "Gimp generates C arrays for OLED & LCD images"

(First post here so I'm not allowed to include links)

If your running Windows you'll need Python support for GIMP which takes a few minutes to install. With GNU/Linux you'll be up and running in seconds. See the Python script for instructions.

...second post, I can link now...

Python plug-in I mentioned in the previous post is at:

http://e2e.ti.com/support/microcontrollers/stellaris_arm_cortex-m3_microcontroller/f/473/p/67340/243805.aspx