TFT 320x240 SSD1289 and UTFT Library

Hello, I'm starting to learn about Arduino, and I've succesfully developed a project with a UNO and various sensors, clock, caracter display and so on.

Now I'm starting to learn about Graphic LCD. I've bought a 320x240 TFT SSD1289 with touch, an SD card and a shield for it. I loaded the demo project and it work fine. So the hardware is fine, and libraries loaded well (on a Mega2560) Then I loaded the demo for display a bitmat on the lcd, but the problems start.. :~

I use the UTFT library from http://henningkarlsen.com The manual is very poor of information, and looking in the web, i found minor info. The command for sending a bmp on the lcd is:

MyGLCD.DrawBitmap(0, 0, 32, 32, bitmap)

where 0, 0 are the starting coordinates, 32, 32, are the ending coordinates, and "bitmap" is the image file, converted with the included tool (i use the converted images in the examples in the library)

When i try to compile the sketch in the example dir "UTFT_Bitmap_128x128" i obtain this error:

UTFT_Bitmap_128x128.ino: In function 'void loop()': UTFT_Bitmap_128x128:31: error: invalid conversion from 'short unsigned int*' to 'unsigned int*' UTFT_Bitmap_128x128:31: error: initializing argument 5 of 'void UTFT::drawBitmap(int, int, int, int, unsigned int*, int)' UTFT_Bitmap_128x128:37: error: invalid conversion from 'short unsigned int*' to 'unsigned int*' UTFT_Bitmap_128x128:37: error: initializing argument 5 of 'void UTFT::drawBitmap(int, int, int, int, unsigned int*, int)' UTFT_Bitmap_128x128:45: error: invalid conversion from 'short unsigned int*' to 'unsigned int*' UTFT_Bitmap_128x128:45: error: initializing argument 5 of 'void UTFT::drawBitmap(int, int, int, int, unsigned int*, int)'

The library is loaded in arduino ide, and the images are just compiled.

i think the error is in the statement and the "icon1" parameter, referred to icon1.c compiled image (that is in the same directory of the project file):

myGLCD.drawBitmap (x*32, y*32, 32, 32, icon1);

but I don't know how to solve. If someone help me to solve this problem, once I've and example sketch working, then I'll be able to advance in my project......

I hope I explain well my issue, and someone help this poor noob! :cold_sweat:

Thanks Rael

I don't know anything about the bitmap stuff but are you aware of the additional information in the tools folder?

Hello.
I had the same issue. You’re using a linux distro, right?
The UTFT example compiles fine under windows but, if you’re using linux, you have to edit the .c file using const, like this:

// Generated by  : ImageConverter 565 v1.0
// Generated from: taskmgr.png
// Time generated: 11.10.2010 22:51:23
// Size          : 2 048 Bytes

#include <avr/pgmspace.h>

const unsigned short icon[0x400] PROGMEM ={

No, I’m not using Linux, I’m using Win7 x64,

I’ve added “PROGMEM” in the const line in the icon1.c file as you suggest but nothing change.

I’ve read in the docs that pgmspace.h is necessary for boards different from DUE, so I’ve already added #include <avr/pgmspace.h> in the main script, and in the .c file with no luck.

the pgmspace.h is already included in main arduino directory (C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr)
so no need for add it, right?
I’ve already tried to create a copy of pgmspace.h in C:\Program Files (x86)\Arduino\hardware\tools\avr but nothing change…
Maybe could it be some problem in the location of project/files?
Now the directory that contain sketch and .c files is located on my desktop.

@Nick_Pyner: I’ve read the info in the tools directory, anyway I’m using (or trying to use :)) the converted image in the example directory, and the work is already done, so no need of the conversion tool for now.

P.S. the errors in line 31, 37, and 45 are referred to all three MyGLCD.DrawBitmap commands for three example images icon1.c, icon2.c, and tux.c

At the end I finally found the problem!

I was using the wrong example file.........I'm a stupid noob......

In the example dir are present avr dir and amr dir. I took the files from amr instead of avr......the differences wasnt so big but when the image file is definied, the command is just a little bit different:

for amr: extern unsigned short icon1[0x400]; for avr: extern unsigned int icon1[0x400];

i hope this could help someone has made my mistake :)

These small differences (short, int, const) are important and can make the code compile or give lots of errors!
Thanks for sharing the solution.

Rael70: At the end I finally found the problem!

I was using the wrong example file.........I'm a stupid noob......

In the example dir are present avr dir and amr dir. I took the files from amr instead of avr......the differences wasnt so big but when the image file is definied, the command is just a little bit different:

for amr: extern unsigned short icon1[0x400]; for avr: extern unsigned int icon1[0x400];

i hope this could help someone has made my mistake :)

Thanks for updating your thread with the solution - unfortunately, most people don't bother.

Good morning for everybody !

I’m a starter with arduino, and I have bought two TFT displays :

1: 2.4" with ILI9325 controller: http://www.ebay.com/itm/2-4-TFT-LCD-Module-Display-Touch-Panel-Screen-PCB-adapter-/400417743247?pt=LH_DefaultDomain_0&hash=item5d3ac1e18f
2: 3.2" with SSD1289 controller: http://www.ebay.com/itm/200908823757?_trksid=p2055120.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT

I’m using an Arduino UNO R3 clone board. The smaller 2.4" display work fine , but the 3.2" display doesn’t work , not at all, just light backlight and that’s all. I’m using tft shield, this one:
http://www.ebay.com/itm/TFT-2-4-LCD-Touch-Shield-Expansion-Shield-for-Arduino-UNO-Mega2560-R3-/281150878452?pt=LH_DefaultDomain_0&hash=item4175e5f2f4
I have tried out UTFT library and many other libraries but the 3.2 TFT don’t work with them , not at all!
How I can use this 3.2" TFT with Arduino UNO R3? This can I use with UNO R3 board at all, or just with Mega2560 board?
Thank you very much !

Hi everybody !

I think I have found the problem: I think the 3.2" TFT has got a 16 bits data interface. I tried out this article:
http://www.sainsmart.com/zen/documents/20-011-918/3.2LCD+UNO.pdf and with the correct wiring it’s working.
My TFT Shield is just working with 8 data bits.
I have tried out the example code, contemplator.ino sketch and is working. But there some patterns in it which is working but there is flickering, vertical flickering white lines.
I speak from experience this flickering is in connection with the drawing speed. When the drawing is slower there is less flickering.
I think my 3.2" TFT coudn’t work in 8 bit data modes if I’m not mistaken. But why there is flickering?
Thank you very much yours answers!