2.4" TFT LCD Shield for Arduino
2.4" TFT LCD Shield for Arduino
Features:
2.4 diagonal LCD TFT display
Bright, 4 white-LED backlight, on by default but you can connect the transistor to a digital pin for backlight control
Colorful, 18-bit 262,000 dierent shades
4-wire resistive touchscreen
240320 resolution
spfd5408 controller with built in video RAM buer
8 bit digital interface, plus 4 control lines
Uses digital pins 5-13 and analog 0-3. That means you can use digital pins 2, 3 and analog 4 and 5. Pin 12 is available if not using the micro SD
5V compatible, use with 3.3V or 5V logic
Onboard 3.3V @ 300mA LDO regulator
Speci cations:
Size: 71*52*7mm
Weight: about 31g
Libraries Included (Kind of)
The shield came packed with one of those tiny CD ROM discs with a few dierent RAR les on it. The one with arduino-UNO in the name seemed like the most likely
candidate, so I opened it up and started poking around.
After some trial and error, including nding the correct library, changing library names, altering include le references, etc., I managed to get
something on the screen. I made many small tweaks to the LCD library to make my life a little easier (see below), but the many references to
Adafruit in the code led me to give their web site a look. There I found a library for a 2.8 touch screen that looks very similar to this one. Im not
sure the code in their libraries will work without modication, but they may be worth taking a look at.
Picture Quality
I didnt have very high expectations in terms of picture quality, so I wasnt disappointed. Overall, I would rate it as good enough for the average hobby project. While
you wont be oored by the rich colors, in the context of price and features, its more than sucient.
Compare the original image below to the 16-bit screen representation to its right. While the picture of the LCD screen doesnt really do it justice, it should give you an
idea of what youll see. The rst thing that will likely draw your attention about the screen image is the very noticeable banding. This becomes less apparent with line
drawings using a simpler color palette, but it is very visible when viewing bitmaps or lling the screen with a solid color.
SD Card Slot
The shield comes equipped with a micro SD card slot, which I really had no real intention of using when I bought it. My curiosity quickly took over, however, and I tried
to run some of the sample code. Unfortunately, I didnt meet with any success during my initial attempts to get it working and threw in the towel completely after
pushing a bit too hard on the card as I inserted it, breaking the connector o the board.
The next day, I decided to give it another go, so I got out my soldering iron and did my best to reattach the connector, despite the miniature nature of the surface
mount pins. I made sure to get plenty of solder on the four legs to keep it rmly attached to the board, then did a less than stellar job of getting a bit of solder on the
tiny pins.
I took a quick glance with a magnifying glass, and it didnt appear that I had left any shorted pins, so I tried the sample code again. Much to my surprise, it worked, and
before long I was looking at my own bitmap images on my Arduino screen.
General
Im still not sure exactly what driver chip my LCD is using. The libraries included with the unit expand into a directory called arduino-9320. I originally took this to
mean that it used the ILI9320 chip and started working from the data sheet I found here to expand functionality as needed. However, some of the sample code does a
driver check before proceeding, as follows:
According to the ILI9320 data sheet, register 0x0 will return 0x9320. On my board, I get a reading of 0xC505. I havent run into anything that hasnt worked thus far, so I
havent done any further research. Disabling the check is good enough for what Im doing at this point.
I have made some modications to the library included with the board, and Ill include my les below. It wasnt until after Id started monkeying with things and
noticing references to Adafruit in the code, that I realized there may be better options already out there. Whether or not they work with this screen is something I have
yet to determine.
Displaying Graphics
The TFT library includes functions for drawing lines, rectangles, rounded rectangles, circles and triangles, all of which can be lled or outlined. There is example code
that cycles through various screen patterns using each.
After I got the SD card reader working, I spent some time concentrating on loading bitmaps. The sample code that comes with the library has a few examples that load
24-bit bitmap les from the SD card and display them on the screen in various rotations. These samples didnt work correctly until I modied the code to use the
setPixel method, which resulted in a very slow display time but worked in all screen rotations.
The writeData method that was originally being invoked simply writes to the displays graphics memory, which is a good thing for speed. However, this method was not
taking screen rotation into account. Studying the data sheet, I found that GRAM Access Direction can be altered such that after a writeData call, the next write
address will be properly calculated based on the current rotation. With that information, I modied the setRotation method to also change the GRAM access direction.
This new setRotation method xed the bitmap sample code to some extent and sped things up considerably. Unfortunately, it was still taking 2.8 seconds to load and
display a 320200 24-bit bitmap. It was time to get serious.
The rs thing I did was switch away from the 24-bit bitmap format. The display uses a 16-bit RGB format (R5G6B5), so it makes more sense to do that transformation
somewhere other than the Arduino if youre just worried about getting it onto the screen as quickly as possible. Furthermore, the standard Windows bitmap le is
stored in a bottom-up format, which adds a little complexity to the direct write method. So, I wrote a little utility to convert my bitmap les to a 16-bit, top-down
format that could be directly loaded into the LCDs GRAM. You can nd that utility here.
Moving to the 16-bit format had a huge impact on performance, though I didnt think to take any timings in this state, as I wasnt quite done. My next step was to
simplify loading by getting rid of the position calculations required for bitmaps that didnt extend the entire width of the screen. The data sheet provides details about
creating a window within the screen, which you can specify the dimensions of. Combining this window setting with the GRAM access direction settings mentioned
above, it is possible to just send the pixel information in bulk and allow the LCD driver chip handle the wrapping.
The end result is fast, loading and displaying a 320240 scooter image in 1.3 seconds and the smaller picture over the top in 129 milliseconds. Ive since been
experimenting with the sdfatlib library for SD card access, and the results have improved even further, bringing load/display time to 1.048 seconds. I was looking more
for a smaller footprint, but Ill take the the speed as well.
Arduino Code
Touch Screen
The display and touch screen features were what I was really looking for from this LCD, though I became somewhat sidetracked by the bitmap examples. The touch
screen example software ran pretty much without a hitch from the beginning using the pin settings for the shield. Essentially, you get two coordinates (X and Y) back
from the screen, plus a Z, which indicates the pressure being applied. Those coordinates coincide with the LCDs default rotation, which is with the Arduinos USB plug
on top in this case, so youll have to adjust those for yourself.
1 #include "TouchScreen.h" ?
2
3 // These are the pins for the shield!
4 #define YP A1 // must be an analog pin, use "An" notation!
5 #define XM A2 // must be an analog pin, use "An" notation!
6 #define YM 7 // can be a digital pin
7 #define XP 6 // can be a digital pin
8
9 #define MINPRESSURE 10
10 #define MAXPRESSURE 1000
11
12 // For better pressure precision, we need to know the resistance
13 // between X+ and X- Use any multimeter to read it
14 // For the one we're using, its 300 ohms across the X plate
15 TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
The one potential area for trouble is the fact that the touch screen shares pins with the LCD. So, if you invoke methods from the touch screen library, then make calls to
the LCD library, you may get unexpected results, as the touch screen library doesnt always leave things in the right state, and the LCD library doesnt put them in the
right state before it does its work. The newer Adafruit libraries may account for this better than the ones Im using, but Ive worked around it for now.
At this point, Ive done a little bit of experimentation with the touch screen, mainly in the form of a numeric input form, as shown below. Ive tried to do some
coordinate calibration based on actual readings, but it seems like I get some occasional outlying values that throw a wrench in things. So, Ive pretty much stuck with
the default values from the sample code and havent had any problems getting very reliable nger positions.
A question was brought up in the comments regarding debouncing the touchscreen input to avoid getting repeat presses. Trying to reliably detect when a user presses
and removes a nger from the screen in all cases has proven to be more dicult than I thought. This is the code Ive written so far, which does a decent job of
registering intentional nger presses with minimal duplication. When I have more time, Ill see if I can improve it a bit.
1 Point getPressPosition() ?
2 {
3
4 Point p, q;
5 int upCount = 0;
6
7 // Wait for screen press
8 do
9 {
10 q = ts.getPoint();
11 delay(10);
12 } while( q.z < MINPRESSURE || q.z > MAXPRESSURE );
13
14 // Save initial touch point
15 p.x = q.x; p.y = q.y; p.z = q.z;
16
17 // Wait for finger to come up
18 do
19 {
20 q = ts.getPoint();
21 if ( q.z < MINPRESSURE || q.z > MAXPRESSURE )
22 {
23 upCount++;
24 }
25 else
26 {
27 upCount = 0;
28 p.x = q.x; p.y = q.y; p.z = q.z;
28 p.x = q.x; p.y = q.y; p.z = q.z;
29 }
30
31 delay(10); // Try varying this delay
32
33 } while( upCount < 10 ); // and this count for different results.
34
35 p.x = map(p.x, tsMinX, tsMaxX, 0, 239);
36 p.y = map(p.y, tsMinY, tsMaxY, 0, 319);
37
38 // I've been focused on rotation 3, with the USB connector on the right-hand side
39 // so, you'll have to add your own code here.
40 switch( ROTATION )
41 {
42 case 3:
43 swap(p.x, p.y);
44 p.x = (320 - p.x);
45 break;
46 }
47
48 // Clean up pin modes for LCD
49 pinMode(XM, OUTPUT);
50 digitalWrite(XM, LOW);
51 pinMode(YP, OUTPUT);
52 digitalWrite(YP, HIGH);
53 pinMode(YM, OUTPUT);
54 digitalWrite(YM, LOW);
55 pinMode(XP, OUTPUT);
56 digitalWrite(XP, HIGH);
57
58 return p;
59 }
SD Card
As I mentioned, the SD card wasnt something I was necessarily looking for from this shield, but it has proven to be a blessing. It works with the standard Arduino SD
library, and Ive also tried the sdfatlib with great results. The cable select should be set to pin 10, and after that, youre ready to go. There is an example called
listles that spits out a directory listing, which is great for both testing that the card works, and as a reminder that youre limited abbreviated le names that turn a
name like BURG_BLUE.BMP into BURG_B~1.BMP.
Source Code
I have attached the TFTLCD libraries with the modications Ive made for rotation and positioning reliability as well as the bulk data load function Im using for
displaying bitmaps. Sample sketches are also included and should work with this LCD without modication.
There seem to be variants of this shield that look the same or similar but function dierently. Many users have had issues with reversed text and coordinate ipping
using the same library I originally provided. In the comments, Mike McCauley added a link to a patched version of the library that may x reverse coordinate issues. I
have now added his patch into my library to avoid further confusion.
If your coordinates appear to be reversed, uncomment either or both of the lines below in TFTLCD.cpp and try again.
1 //#define INVERT_X ?
2 //#define INVERT_Y
Thank you to everyone who has participated in the comments and helped nd solutions to make this board useable for everyone.
I was able to get this screen working as a shield with an Arduino Mega 2650 as well. I posted an article with an updated source le. Until I get some feedback, Ill
consider it experimental. The article is here.
You may also like:
Adding Mass Actions to Magento Bitmap Converter for Arduino LCD Touch Screen Shield for Arduino
Orders UNO
DIY Virtual Wall for Roomba Part New Life for an Old Netbook Touch Screen on the Arduino Mega CapStatus
Two 2560
AdsbyShareaholic
Darren
November 26, 2013
Hey Justin,
How did you go with the touchscreen code? I have the same shield but only get double characters when I press a number (doing the touch numeric keyboard thing as
well).
Cheers,
Darren.
Great question, Darren. Ive been struggling with that one a bit myself. I updated the article with the code Ive written up to this point, and if I come up with something
even more reliable, Ill update it again. Id like to get it to the point where I can reliably tell exactly when the user presses and releases the screen without duplicates.
Rahul
June 25, 2014
relic
September 16, 2014
Hi,
What do I need to compile the bmp2lcd utility in Windows? Can I use Atmel Studio or do I need another compiler? I want to try your 16 bit bmp method but dont know
exactly what to compile the source with.
Thanks in advance.
Darren
November 26, 2013
Yeah, that looks like the problem. Ive run a serial port test on it and it doesnt reliably hold the pressure level in the Z portion of the pointer, dropping back to 0 in
between readings. Certainly makes it dicult to detect a press and perform some form of Schmitt trigger on it to stop the double-striking.
Cheers, and thanks for the reply!
Darren.
I took another look at the TouchScreen.cpp le in the libraries folder. There I found this, which may describe what youre talking about, inside of the getPoint method.
#if NUMSAMPLES == 2
if (samples[0] != samples[1]) { valid = 0; }
#endif
if (! valid) {
z = 0;
}
I tried changing the NUMSAMPLES to 3, and I got perfect results when used in conjunction with the code I posted above. Ill play more, but it looks like additional
sampling or simply not disregarding the z if back-to-back samples match might be a step toward the x.
Rexx
October 9, 2015
The problem is that the getPoint routine returns z=0 for two dierent cases: when pressure is zero and when their oversampling algorithm nds values that it
considers invalid. A solution Ive used is to alter lines around 155 in TouchScreen.cpp from
if (! valid && z > 0) {
z = 0;
}
to
if (! valid && z > 0) {
z = -1;
}
This returns z=0 when not pressed (i.e. nger up, and z=-1 when the oversampling routine detects invalid values. You can test specically for z==0 in the sketch to
detect the nger lifted condition without it being spuriously triggered by the oversampling routine while the nger is still down.
Darren
December 1, 2013
Hi Justin, thanks for your work on this I plan to feature it in a story Im writing for APC magazine (apcmag.com) shortly.
Cheers,
Darren.
Mihail
December 5, 2013
I got Unknown driver chip C0C0, on same shield. What can be the dierence?
Wow. Theres part of me that wonders if its even reading the register correctly. Im playing with the Adafruit library, and thats returning 0x0 for the ID, though Ive
gotten it to produce graphics on the screen by forcing it to initialize properly.
Sebastian
December 28, 2013
Hi! Your work here helped me a lot! Right now Im modifying the Adafruit library to work with this shield, I replaced part of the code on the Adafruits with the
_regValues[] and the initScreen from the CDs library and it worked! But I have the problem that X axis is mirrored, so the characters look backwards. If you have
made something to solve this orientation problem, it would help me a lot!
First, your English is great. I ran into the same problem with the Adafruit library when I tried it, but I havent had a chance to get back in and see what can be done to x
the backwards problem. Once the holiday season has passed and I get back to normal life, Ill take another look and update you.
Brian
January 15, 2014
I just picked up this same lcd. I also noticed that text is upside down and backwards. I discovered this blog (which is much appreciated, btw) because I was googling
spfd5408 arduino backwards. However, Im not certain that our displays are identical. Mine has some printed icons on the bottom and is intended to be used in a
phone, in a portrait orientation. Im sure you would have mentioned if the text in the example program didnt appear correct.
Any hoo
I started thinking about how the text in the graphic demo is displaying on MY screen. X=0 and Y=0 is actually the bottom left (when viewed in portrait). But I would
prefer that the origin be at the top left and the display be viewed in a landscape orientation. So I looked at the code in TFTLCD.cpp for drawing characters and strings
and swapped X and Y by adding this line (as the rst line) to drawString() and drawChar():
uint16_t t = x;x=y;y=t;
That works, but the fonts are sideways. So I then looked at the hex in glcdfont.cpp. For a moment, but only a moment, I considered that I really needed completely
dierent font codes. The I looked more closely at drawChar() and just swapped the counters used to walk through the bits of each hex code
void TFTLCD::drawChar(uint16_t x, uint16_t y, char c,
uint16_t color, uint8_t size) {
uint16_t t = x;x=y;y=t;//xy
@Sebastion, Not sure if this is the same thing youre talking about, but thought Id mention it since this blog is only a couple months old.
Thank you, Brian. I still havent had a chance to try it, but it sounds like youve got it gured out.
Gunner
February 2, 2014
@Brian, I too just purchased the same shield former phone button silkscreen on the touchscreen and inverted touch orientation and backwards text.
Unfortunately, my coding skills are still in their infancy and I am unclear on implementing the changes you suggest I know how to edit the les, just not the precise
location of any changes and /or additions to the code. I took a few stabs at it, but just get compiling errors. Any chance on further clarication of the exact changes
required in the TFTLCD.ccp, and/or updated libraries?
Thanks!
Tomek
December 27, 2014
Id like to say that your way did not work in my case (mirrored letters), but i have dealt with it by changing the bit rotation. In order to do it, you need to modify the
following lines in drawChar function:
good luck
Psad
September 30, 2015
FYI based on your above comments the phone icons. BTW Im not using this code but
I Purchase 3 displays from a an oshore vendor. Two with the phone icons on the bottom one without.
I eventually was able to get the one without icons working but not the 2 with icons yet (they just white screen).
I thing must be dierent even if the vendor says they are not.
Brian
January 15, 2014
Ooops. My drawChar() instance method didnt make it. I swapped the i and j loop counters in the calls to drawPixel() and llRect(), so that j was used to modify the x
coordinate and i was used to modify the y coordinate.
Julie
January 29, 2014
Brian,
I found the line in the le but it will not compile.
Seems a few too many closing brackets at the end. Do you have a chunk of code I can just drop in? If you could post it here, Id appreciate it.
HI Justin;
I have been downloaded your library in rar format. It compiles satisfactorily problem is that SD Card is not working properly. The message shown by Arduino serial port
monitor is SD Card initilization failed. Although I selected proper chip select of SD Card. Kindly, tell me how can I achieve this goal. Your prompt reply is highly
appreciated.
When I received my LCD, the SD card connector didnt seem to be very well attached, and it didnt work until I re-soldered it to the board.
Alex
January 25, 2014
Hi,
I have the very same display (2 of them), Ive tried to download your library but my display stay stubbornly blank Ive tried on arduino uno, a clone of uno But
nothingh !
I start supposing that Ive got a bad lot, I got chinese chep as welll
Apart from your modied library what I should use ? Also any advice about the arduino suite ? Ive used several but no way.
Alex.
If your Arduino is working for everything else, you might try the Adafruit code. Other than that, its hard to say. I havent really done too much with the Arduino yet, but
everything Ive tried so far seems to be working without much of a hassle. Ive got two boards, one that is a real Arduino, and one that I assume must be a clone based
on the fact that I got it on eBay for a fraction of the price.
Alex
January 31, 2014
Thanks for your help, Ive tried your library and adafruit but I was not lucky. Perhaps I should start from scratch, or perhaps I was plainly cheated !
Alex.
Pierre
February 9, 2014
Hello Justin,
I really thank you for your really great work, im quite new at the Arduino world, so its impossible for me to make this type of things . I have the same shield/screen,
and your library works really well, but there are stil 2 problems:
I read in some comments above that some persons have the text upside down, and i have the same problem. As im new, i couldnt understand whats the solution, so
could you please explain a bit how to solve it?
I didnt understand how to use the touchscreen. Im using the Arduino Mega2560, so im using the pins a)-A4 and 22-29. which pins are used by the touchscreen, and
how do I use it? i saw that it shares pins with the LCD, but even if you explained somehow how to use it, im not an expert and cant use it
Thank you very much again for this awesome library and I hope for your helpful reply,
Pierre LACLAU, France.
P.S.: Do you have any tutorial or something like that ? i think itd be really handy for persons like me !
Pierre
February 9, 2014
Sorry for double post (and very long comment), but I found the solution for the text orientation issue. Still not for the touchscreen, who know ill maybe nd it ?
For those like me who dont understand the explanations in the comments above, let me do a little and simple tutorial:
5. Now there are two cases: if the text is just upside-down, go to step 5.a.
if the text is just sideways, go to step 5.b.
if the text is both upside-down AND sideways, then go to step 5.c.
I hope it is clear, and hope itll be useful for some of you. Now it works ne for me, this library is really perfect!
For the touchscreen library, i still dont get it
Thanks in advance for your future reply, Justin! (and maybe another person?)
steeve madison
February 10, 2014
the tftlcd.cpp that i have , that come in the rar le from this site look dierent
// draw a character
void TFTLCD::drawChar(uint16_t x, uint16_t y, char c,
uint16_t color, uint8_t size) {
for (uint8_t i =0; i<5; i++ ) {
uint8_t line = pgm_read_byte(font+(c*5)+i);
for (uint8_t j = 0; j>= 1;
}
}
}
steeve madison
February 10, 2014
sorry for double post wrong cut and paste
// draw a character
void TFTLCD::drawChar(uint16_t x, uint16_t y, char c,
uint16_t color, uint8_t size) {
for (uint8_t i =0; i<5; i++ ) {
uint8_t line = pgm_read_byte(font+(c*5)+i);
for (uint8_t j = 0; j>= 1;
}
}
}
Pierre
February 16, 2014
Well, i dont know why you have another code, the best solution id give you is downloading the changes made by Mike McCauley (the comment just below) and testing
it. It personally solved all my problems, maybe itll be useful for you too ?
If you still have problems, just comment again and ill see if I can do something..!
Mike McCauley
February 12, 2014
Thanks man, I just got this lcd yesterday and tried to make this work for few hours :D, but unfortunately when it started to work the image was mirrored. But the
TouchScreen les are corrupted, the program wont compile when they are in the library folder, theres no problem after removing them so maaaaany thanks :).
Pierre
February 16, 2014
Thank you very much Mike, your changes solved all my problems ! now I can use this LCD to control my whole bedroom !
thomas
May 9, 2015
can you help me . Im newest . I got the same TLC 2.7 but I dont know how make it work .. Thanks you
Thank you very much, Mike. I added an update to the article making your solution easier to nd.
DANS
February 27, 2014
Justin, can you kindly send me the example of the keypad test you have done, I would be really interested in seeing how you have acheived this.
Big thanks
Daniel
Hey, Daniel. I had a project in mind for this screen, but too many other things got in the way, and I never nished working on it. My keypad test can be downloaded here.
smrutee
March 27, 2014
hey! i have downloaded justins as well as mikes code. in justins code there is a pin LCD_CD dened on the pin A2, but theres no such pin on the LCD, where does it go
exactly? can someone please help me ASAP? i am using the exact shield that justin has put up on the blog.
Stephen
September 17, 2015
Elnur
January 5, 2015
Hi, I have got this screens today 2 of them, but after loading test sketch, screen just blink and does not do anything else. Im running it on Arduino Mega with modied
TFTLCD.cpp from this topic: http://misc.ws/2014/06/26/touch-screen-on-the-arduino-mega-2560/, what could be wrong?
Ken Wagnitz
February 27, 2014
Ken Wagnitz
February 28, 2014
No luck getting touch input to work. Your sketch comments say to use a multimeter to read the X+ to X- resistance. But you dont say where to measure. The exible
strip going away from the screen has its insulated side on the outside. I presume the pins going to the Arduino arent analog voltages in? Anyway, I guess poor
calibration would only mean wrong screen position reported, I dont see any response, either on the screen or on the serial monitor. Incidentally I had to set font[] to a
const in glcdfont.c to compile. (Using Mikes library.)
Should the screen drop in brightness when running your KeypadTest sketch? Resetting briey brings it up to full brightness. -Or is that an indication I have a pin
mismatch with your code?
Could be that I have brummy screens. (I have 3.)
On the KeypadTest sketch, I set the background color to a greyish tone, which may explain the drop in brightness you notice:
The notes in the other sketch about measuring with the multimeter are not mine, Im afraid. Those were in the sketch originally, and I didnt remove them. It looks like
you should measure between the pins mentioned in the touch screen set-up denes. So, in the example below, I would measure between the A2 pin (X-, LCD_RS) and
digital pin 6 (X+, LCD_D6). I just did so on my board, and it read 326 ohms.
Ken Wagnitz
February 28, 2014
Ken Wagnitz
February 28, 2014
Also I ran your bitmap sketch, with your bitmap. I dont see banding, so maybe not all screens suer from it.
gulzar
March 2, 2014
hello Justin , your keypad code is showing like mirror in my screen. Please tell me how to get the actual display
Justin Post author
March 2, 2014
I just updated my download to include the patched version of the library that provides for coordinate ipping. Please update your library and change the denes as
needed to see if it helps. I updated the post with instructions as well.
Mitosis
March 2, 2014
Hello to all,
I have a new arduino mega. I try to make the LCD to work but with no luck. The LCD remaining white. I test it on an arduino uno and work like a charm. Could anyone
help me??
Thanks in advance
Ken Wagnitz
March 3, 2014
gulzar
March 6, 2014
Bryan
March 9, 2014
Hi,
I had used the same LCD with Arduino using Mike McCauleys library. It could compile and download but the screen is showing blank. Is my TFT dead?
Before that I tried with Freescale Freedom board. Is my internal chip is damaged?
Thanks in advance!
Bryan
Bryan
March 9, 2014
//Serial trace
Paint!
Unknown driver chip 6767
//code
uint16_t identier = tft.readRegister(0x0);
if (identier == 0x9325) {
Serial.println(Found ILI9325);
} else if (identier == 0x9328) {
Serial.println(Found ILI9328);
} else {
Serial.print(Unknown driver chip );
Serial.println(identier, HEX);
while (1);
}
Thanks,
Bryan
Lahiru
September 28, 2015
HI Bryan,
I am having the same problem here. It shows Unknown driver chip 6767.
Did you nd any solution? I tried a lot of libraries and none of them are working.
I really appreciate if you could help me on this.
Thanks.
julio ferreira
March 27, 2014
Hi Guys.
Ive searched for the entire web, and found this site. Unfortunaly My board didnt work with any of your tips. In my last hope, I post my problem in the Arduino google+
page and, in minutes, I received a tip about this site:
http://www.smokeandwires.co.nz/blog/a-2-4-tft-touchscreen-shield-for-arduino/
A voil, the board worked like a charm.
I hope this tip help more people like me.
Dan Riches
September 28, 2015
Thanks Julio Ferreira for the Smoke and Wires link, this is the only implementation that gave me any results. It worked awlessly whereas all others failed miserably. My
quest for a cheap LCD (from ebay and was the blue mcufriend.com 2.8 inch touchscreen) has nally come to a close.
Yay!!!
Maverick
April 8, 2014
Hi, First of all let me tell you that I nd your website very informative.
I purchased some of these screens a while ago, and I just nally realized I couldnt use the library from Adafruit and started trying to nd the info like crazy.
I found your block and while I got it working, using everyones corrections I still do get the screen Y axis inverted.
I have corrected the .cpp le that supposedly alters the ipping, with no success. My question is, once I modify the .cpp le, do I save, close and re-upload the
program to the arduino? or is there something else involved? since its a .cpp le on its own I couldnt re-compile it
Thanks
After modifying the .cpp le, youll have to recompile the sketch and re-upload it to the Arduino.
Maverick
April 10, 2014
paul
April 21, 2014
hi justin,
maybe you can help me? i have the same display. and i dont get it work correctly. have you ever got it working on a mega2560? thats what i tried to do. my results so
far:
1. the touchscreendemo from adafruit fold the following message on the serial monitor :unknown driver chip: 7783. you said you have got C0505 is that correct?
that would be 50437 in decimal?
2. i got the paint-example working, but without any touch-functionality, so there is just the static picture of the color-elds and the black drawing area.
3. in the touchscreendemo i am able to see some x- and y-coordinates, when i press the shield. i am not sure about these coordinates: the x-coordinate shows always
the same value, regardless of the place where i press. she y- and z- values are changing.
so, summing up, i would say, the display itself seems to work, because, the dierent techniques are ok. but not all together? do you think it is a question of the driver?
or the arduino ice-version? wich one do you use? or do you think the mega2560 is the problem? or do you think the shared pins can cause that problem? i would say the
shared pins could only cause som ickering or delays, or do you think, it could be a reason for totally not-working together of touch-and picture?
thanks for your suggestions- i am sure, i am not the only one with this problems
Arjan
May 22, 2014
Hey Justin,
My problem was that i had to press the touchscreen twice before something would be written to the screen.
But thanks to your KeypadTest example, i was been able to solve the problem.
many thanks
Peter
May 29, 2014
Hello,
the display looks interesting to mee. In my applycation I would like to use I2C bus on pin A4 and A5. On Ebay I saw several pictures, showing the display pin connections,
where pin A4 is used to reset the display. Is it possible to cut this and connect display reset pin to Arduino reset pin?
many thanks
vadi
May 31, 2014
hi
my display from mcufriend shows color banding as shown in https://mbed.org/questions/3270/Banding-on-24-display/ what should i do to correct the mistake
Pawel
June 16, 2014
Hi,
Change a line in TFTLCD.cpp from 0x0090,0x0010, to 0x0090,0x0071,. I do not know the proper value, but at least it works for me.
regards
Danny
December 7, 2014
Thanks Pawel
I would like to know what this changes for future reference but this did the job for me!
Danny
December 7, 2014
i tried your library in your source code but still i donot see any thing on the screen display only the white backlight . i tried a lot ,plz i really need this working .
i solved the errors i got while compililing but it doesnt work .if u can help me in just getting any stu over this screen .plz tell me what i am doing wrong . i am using
mega board
I just posted the following article about getting it working with the Mega. I ran into some timing issues with the Mega that I didnt have with the UNO.
http://misc.ws/2014/06/26/touch-screen-on-the-arduino-mega-2560/
Rictronics
July 1, 2014
Hi Justin.
Excellent article . With all that I found on the net, there was work to do this display.
I have only one doubt the tftpaint.ino sketch gives me this error.
regards
Thank you
Rictronics
July 1, 2014
Maaz Shaikh
July 15, 2014
Manoj Vora
July 18, 2014
ChilliTronix
September 2, 2014
We have just bought some of these to sell on eBay, and have to say this is outstanding work, well done.
The reason for posting though Which touchscreen library should be used?
ChilliTronix
September 2, 2014
Hmm.. tried the Adafruit touch screen library but needed to change Point P to TSPoint p.
Also found that the x plate resistence is 410 ohms and the y is 570. Whats better is that the X and Y seem reversed.
Can the code be altered to accomdate diering X and Y resistence and the same X and Y ipping?
Albert
September 4, 2014
For the people who do not get it done, download:
https://github.com/Smoke-And-Wires/TFT-Shield-Example-Code
https://github.com/adafruit/Touch-Screen-Library
https://github.com/adafruit/Adafruit-GFX-Library
For the people who do have an arduino Mega 2560 DONT forget to modify the SWTFT.cpp.
Change
// Use the include which corresponde to your arduino
//#include mega_24_shield.h//
#include uno_24_shield.h
into
And here you go you can plug in the board into the Mega 2560 directly
Albert
September 4, 2014
jay
September 5, 2014
thanks alot
this was really helpful
jay
Matt Symes
October 13, 2014
Can anyone give me some pointers as to what I would need to modify to make this work with Arduino Leonardo. Im a bit of a noob but would I be correct in thinking
that:
1) SD card wont work as Uno does SPI via the Digital pins whereas Leonardo has separate pins specically for SPI.
2) I need to change the references that map the various pins of the shield to things like PORTB, PORTD etc as the Leonardo port mappings dier from the UNO.
I picked up the mcufriend 2.8inch touchscreen+SD reader for 6 and would love to get it working with my Leonardo but its just (well hoping its *just*) beyond my
capabilities at the moment any tips much appreciated.
Ramis
October 22, 2014
I got a 2.8In one of these from Amazon, all it says in it is www.mcuriend.com and 2.8 TFT LCD Shield
It came with a mini cd.
So far i think i have tried everyones code in the world and all it will do is light up all white????
I see in the serial out the line LCD driver Chip: 0 which makes me somewhat suspicious, im pretty sure that should not have a value of zero!
Ive checked the pin assignments in the swift code & all looks okay. still it just lights up blank white.
Am i missing a massive elephant here or are both of the tft#s i bought du???
Any and all help appreciated, im not trying to be lasy here & use someone elses code, I just want to verify i havent been shipped two du screens!
https://github.com/Smoke-And-Wires/TFT-Shield-Example-Code
I bought a 2.8 screen on eBay that also says www.mcufriend.com on it, and it works great.
Tom
November 17, 2014
Hi,
I bought 2.4 TFT. Plugged it into Arduino MEGA, included mega_24_shield.h and after uploading code what I can see its just full screen of color dots. Chip id is 0. Is it
faulty TFT board or something else? Thanks.
Danny
December 7, 2014
Thanks Pawel,
I would like to know what this changes for future reference but this did the job for me!
Richard
December 7, 2014
I also bought this lcd on ebay like Ramis and have the same problem with white screen. The ebay reseller has linked his item to this page for usage instructions but
doesnt provide support because of the low price.
Hard to tell if it is broken unless someone has experienced the same problem and has solved it.
Richard
December 7, 2014
Finaly got it working using instruction from this web site, but only with a UNO, not the MEGA.
Andrea
December 19, 2014
I downolad code, i had an arduino YUN but when i build sample graphicstest i recive error:
Arduino\libraries\TFTLCD\TFTLCD.cpp:743:4: error: #error No pins dened!
Arduino\libraries\TFTLCD\TFTLCD.cpp:761:4: error: #error No pins dened!
Arduino\libraries\TFTLCD\TFTLCD.cpp:799:4: error: #error No pins dened!
Arduino\libraries\TFTLCD\TFTLCD.cpp:832:4: error: #error No pins dened!
L Mitchell
January 5, 2015
For Andrea, Leonardo Kusch and Manoj Vora who had this error and were using a Yun, Leonard and something unknown respectively
The Leonardo and Yun have dierent SPI pinouts to the UNO, so youll not be able to connect the shield directly to your arduino and youll need to use jumpers or
something else to connect the display to your arduinos. I know the Leonardo does NOT duplicate the SPI pins like the UNO, Nano, others, on the Leonardo they are only
connected to the 6 pin ISCP (on Uno the 4 of these pins are that make up SPI are also routed through pins 10-13). So these would need to be re-routed with jumpers.
(The Mega has dierent pinouts to the Uno of course too, but obviously these are being accounted for the in the code and examples.)
Good Luck
rue_mohr
December 21, 2014
could you PLEASE post the exact sketch you used to do ANYTHING with this sceen, nding the UTFT library to operate it took about 3 hours and Im getting corrupt
results, NOBODY who has these screens working has posted the initialization line they are using.
mine is myGLCD(UNO_24,A2,A1,A3,A4);
what are you using!?
Mark
December 23, 2014
I have a problem,The code function can work, but the screen have many lines, as shown below, how to x this problem.Thx
https://www.ickr.com/photos/109504213@N05/16088480145/
Richard Thomas
December 23, 2014
Just posting to say that I am also having issues with this screen. The shield looks very similar but it has the phone type icons as someone else has described. It has
mcufriend on the screen though that is not useful. The button is in a slightly dierent place to yours (where the bare solder pads are on yours).
I am able to compile the graphictest ne but when running, the screen just ickers, nothing is displayed. I am worried I damaged something as the bottom of the board
is not protected and the contact there touched the USB shield (something people need to be aware and careful of). Note that it does not icker when the program is
not running so that at least something appears to be happening.
The Arduino itself is a UNO clone so Im not sure if that aects anything.
I guess I will grab the adafruit library and see if that does anything. Just getting some kind of output would be good.
Thanks for the good work you have done.
Will Mackey
January 7, 2015
Have the same excaty problem. This is the only version of any library that does anything on the screen and its not much, just some ickering. I also tried to play with
several dierent touchscreen libraries but cant get anything sensible out of them. Even the pressure value is jumping between -297 and 0.
My TFT has http://www.mcufriend.com label on the bottom.
Cary
December 25, 2014
Hi,
Thanks for posting this. The section on the SD card was what I needed to get mine working.
Ive been working with the Adafruit library but , like you, was not able to read the device correctly.
tft.reset();
if(identier == 0x9325) {
Serial.println(F(Found ILI9325 LCD driver));
} else if(identier == 0x9328) {
Serial.println(F(Found ILI9328 LCD driver));
} else if(identier == 0x7575) {
Serial.println(F(Found HX8347G LCD driver));
} else if(identier == 0x9341) {
Serial.println(F(Found ILI9341 LCD driver));
} else {
Serial.print(F(Unknown LCD driver chip: ));
Serial.println(identier, HEX);
return;
}
It turns out that the device seems to require some time between tft.reset() and tft.readID(). when I put a delay(500) between these calls everything started to work.
Regards Cary
Azhar
December 27, 2014
Can i interface both Ethernet W5100 R3 and above LCD TFT touch display shields simultaneously with UNO R3. I also need 2 or 3 analog and 2 digital IOs for interfacing
thermocouples and sounders .
Please advise whether UNO R3 can be used for same or not.
Stuggit123
December 27, 2014
I cannot get my LCD to work! At rst it would always be white, but now I found this and it seemed reliable. I tried it but the one I tried (tftpaint) had an error:
tftpaint.ino: In function void loop():
tftpaint:94: error: Point was not declared in this scope
tftpaint:94: error: expected `; before p
tftpaint:105: error: p was not declared in this scope
Stuggit123
December 27, 2014
Ok, I tried to change Point to TSPoint and it nally uploaded, but I get this in serial and a white display:
Paint!
Unknown driver chip C0C0
janak
January 2, 2015
How touch-panel (TFT ili 9325 Display) work with ATMEGA32 controller. plz help me.
Pingback: Controlar TFT Pantalla Tactil Shield Arduino 2,4 China | The Inventor's House
Elnur
January 6, 2015
I did managed to get mine 2.8 tft LCD working with adafruit library, just forcing it to recognize my chipset 8357, despite Im using Arduino MEGA (connecting digital
pins to 22-29) and more its mirrored, but at least working. Now question is : how to make it to work with original pins (2-9) is it possible? What needs to be changed in
adafruit library les to remap digital pins?
Aamer
January 18, 2015
Thank you all! Very helpful in getting my TFT to work. Now I am facing problem with variables. How can I display variables in tft.print(). I am digging in the library le
but unable to gure out yet. Quick response is highly appreciated!.
Aamer
January 18, 2015
Sorry! forgot to mention. Actually problem is with using static text and variable at the same time.
Farrukh
January 27, 2015
I am using the same tft, have used dierent libraries of utft and adafruit. For me each of the library compiles and uploads just right. Even in serial monitor everything
just works ne. The chip in serial monitor that i get is 154 in HEX. But the screen just lights up and stays blank. None of the example like paint and graphics test are not
working. I am using UNO board with this tft. Also i have replaced the tft and UNO boards,but the problem stays as same. I really need to get this working. Help plzz
Buhosoft
January 29, 2015
I have been investigated and i think that the TFT display use a S6D0154 controller.
Do you have the driver for Arduino?
I just came to that conclusion yesterday afternoon as well, and I think I may have found some valid initialization values for it. Unfortunately, I dont any of those screens
to test with, but Im modifying the driver id reader sketch to try to do a ll screen. Im probably just an hour or so away from having it ready.
Volkan
February 1, 2015
if Lcd Driver Chip: 154
0x0154
Samsung S6D0154
library
https://github.com/samuraijap/TFTLCD-Library
#ifndef _pin_magic_
#dene _pin_magic_
// When using the TFT shield, control and data pins exist in set physical
// locations, but the ports and bitmasks corresponding to each vary among
// boards. A separate set of pin denitions is given for each supported
// board type.
// When using the TFT breakout board, control pins are congurable but
// the data pins are still xed making every data pin congurable
// would be much too slow. The data pin layouts are not the same between
// the shield and breakout congurations for the latter, pins were
// chosen to keep the tutorial wiring manageable more than making optimal
// use of ports and bitmasks. So theres a second set of pin denitions
// given for each supported board.
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
// Read 8-bit value from LCD data lines. The signle argument
// is a destination variable; this isnt a function and doesnt
// return a value in the conventional sense.
#dene read8inline(result) { \
RD_ACTIVE; \
DELAY7; \
result = (PIND & B11010000) | (PINB & B00101111); \
RD_IDLE; }
// These set the PORT directions as required before the write and read
// operations. Because write operations are much more common than reads,
// the data-reading functions in the library code set the PORT(s) to
// input before a read, and restore them back to the write state before
// returning. This avoids having to set it for output inside every
// drawing method. The default state has them initialized for writes.
#dene setWriteDirInline() { DDRD |= B11010000; DDRB |= B00101111; }
#dene setReadDirInline() { DDRD &= ~B11010000; DDRB &= ~B00101111; }
#dene write8inline(d) { \
PORTD = (PORTD & B00000011) | ((d) & B11111100); \
PORTB = (PORTB & B11111100) | ((d) & B00000011); \
WR_STROBE; }
#dene read8inline(result) { \
RD_ACTIVE; \
DELAY7; \
result = (PIND & B11111100) | (PINB & B00000011); \
RD_IDLE; }
#dene setWriteDirInline() { DDRD |= B11111100; DDRB |= B00000011; }
#dene setReadDirInline() { DDRD &= ~B11111100; DDRB &= ~B00000011; }
#endif
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
#dene write8inline(d) { \
PORTH = (PORTH&B10000111)|(((d)&B11000000)>>3)|(((d)&B00000011)<<5); \
PORTB = (PORTB&B01001111)|(((d)&B00101100)<<2); \
PORTG = (PORTG&B11011111)|(((d)&B00010000)<<1); \
WR_STROBE; }
#dene read8inline(result) { \
RD_ACTIVE; \
DELAY7; \
result = ((PINH & B00011000) <> 2) | \
((PING & B00100000) >> 1) | ((PINH & B01100000) >> 5); \
RD_IDLE; }
#dene setWriteDirInline() { \
DDRH |= B01111000; DDRB |= B10110000; DDRG |= B00100000; }
#dene setReadDirInline() { \
DDRH &= ~B01111000; DDRB &= ~B10110000; DDRG &= ~B00100000; }
#else // Mega w/Breakout board
/*
#dene write8inline(d) { PORTA = (d); WR_STROBE; }
#dene read8inline(result) { \
RD_ACTIVE; \
DELAY7; \
result = PINA; \
RD_IDLE; }
#dene setWriteDirInline() DDRA = 0x
#dene setReadDirInline() DDRA = 0
*/
// Because the MEGA port to pin mapping is very messy it is necessary to shift the data bits around a lot.
#dene write8inline(d) { \
PORTE = (PORTE & B11001111) | ((d <> 2) & B00001000); \
PORTG = (PORTG & B11011111) | ((d <> 3) & B00011000); \
PORTH = (PORTH & B10011111) | ((d << 5) & B01100000); \
WR_STROBE; }
#dene read8inline(result) { \
RD_ACTIVE; \
DELAY7; \
result = ((PINH & B00011000) << 3) | ((PINE & B00001000) <> 1) |((PINE & B00110000) >> 2) | ((PINH & B01100000) >> 5); \
RD_IDLE; }
// // These set the PORT directions as required before the write and read
// // operations.
#dene setWriteDirInline() { DDRE |= B00111000; DDRG |= B00100000; DDRH |= B01111000;}
#dene setReadDirInline() { DDRE &= ~B00111000; DDRG &= ~B00100000; DDRH &= ~B01111000;}
#endif
// All of the functions are inlined on the Arduino Mega. When using the
// breakout board, the macro versions arent appreciably larger than the
// function equivalents, and theyre super simple and fast. When using
// the shield, the macros become pretty complicatedbut this board has
// so much code space, the macros are used anyway. If you need to free
// up program space, some macros can be removed, at a minor cost in speed.
#dene write8 write8inline
#dene read8 read8inline
#dene setWriteDir setWriteDirInline
#dene setReadDir setReadDirInline
#dene writeRegister8 writeRegister8inline
#dene writeRegister16 writeRegister16inline
#dene writeRegisterPair writeRegisterPairInline
#elif dened(__AVR_ATmega32U4__)
// Arduino Leonardo
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
#dene write8inline(d) { \
PORTE = (PORTE & B10111111) | (((d) & B10000000)>>1); \
PORTD = (PORTD & B01101111) | (((d) & B01000000)<<1) | ((d) & B00010000); \
PORTC = (PORTC & B01111111) | (((d) & B00100000)<<2); \
PORTB = (PORTB & B00001111) | (((d) & B00001111)<<4); \
WR_STROBE; }
#dene read8inline(result) { \
RD_ACTIVE; \
DELAY7; \
result = ((PINE & B01000000) <> 1) | \
((PINC & B10000000) >> 2) | ((PINB & B11110000) >> 4) | \
(PIND & B00010000); \
RD_IDLE; }
#dene setWriteDirInline() { \
DDRE |= B01000000; DDRD |= B10010000; \
DDRC |= B10000000; DDRB |= B11110000; }
#dene setReadDirInline() { \
DDRE &= ~B01000000; DDRD &= ~B10010000; \
DDRC &= ~B10000000; DDRB &= ~B11110000; }
#dene write8inline(d) { \
uint8_t dr1 = (d) >> 1, dl1 = (d) <>3) |\
(dr1 & B00000010) | ((d) & B00010000); \
PORTC = (PORTC & B10111111) | (dl1 & B01000000); \
PORTB = (PORTB & B11001111) |(((d) & B00000011)<<4); \
WR_STROBE; }
#dene read8inline(result) { \
RD_ACTIVE; \
DELAY7; \
result = (((PINE & B01000000) | (PIND & B00000010)) <> 1) | \
#endif
// On the Leonardo, only the write8() macro is used though even that
// might be excessive given the code size and available program space
// on this board. You may need to disable this to get any sizable
// program to compile.
#dene write8 write8inline
#elif dened(__SAM3X8E__)
// Arduino Due
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
#dene write8inline(d) { \
#dene setWriteDirInline() { \
PIOD->PIO_MDDR |= 0x00000080; /*PIOD->PIO_SODR = 0x00000080;*/ PIOD->PIO_OER |= 0x00000080; PIOD->PIO_PER |= 0x00000080; \
PIOC->PIO_MDDR |= 0x25E00000; /*PIOC->PIO_SODR = 0x25E00000;*/ PIOC->PIO_OER |= 0x25E00000; PIOC->PIO_PER |= 0x25E00000; \
PIOB->PIO_MDDR |= 0x08000000; /*PIOB->PIO_SODR = 0x08000000;*/ PIOB->PIO_OER |= 0x08000000; PIOB->PIO_PER |= 0x08000000; }
#dene setReadDirInline() { \
pmc_enable_periph_clk( ID_PIOD ) ;pmc_enable_periph_clk( ID_PIOC ) ;pmc_enable_periph_clk( ID_PIOB ) ; \
PIOD->PIO_PUDR |= 0x00000080; PIOD->PIO_IFDR |= 0x00000080; PIOD->PIO_ODR |= 0x00000080; PIOD->PIO_PER |= 0x00000080; \
PIOC->PIO_PUDR |= 0x25E00000; PIOC->PIO_IFDR |= 0x25E00000; PIOC->PIO_ODR |= 0x25E00000; PIOC->PIO_PER |= 0x25E00000; \
PIOB->PIO_PUDR |= 0x08000000; PIOB->PIO_IFDR |= 0x08000000; PIOB->PIO_ODR |= 0x08000000; PIOB->PIO_PER |= 0x08000000; }
#dene write8inline(d) { \
PIO_Set(PIOC, (((d) & 0xFF)<<1)); \
PIO_Clear(PIOC, (((~d) & 0xFF)<PIO_PDSR & 0x1FE) >> 1); \
RD_IDLE;}
#dene setWriteDirInline() { \
PIOC->PIO_MDDR |= 0x000001FE; /*PIOC->PIO_SODR |= 0x000001FE;*/ PIOC->PIO_OER |= 0x000001FE; PIOC->PIO_PER |= 0x000001FE; }
#dene setReadDirInline() { \
pmc_enable_periph_clk( ID_PIOC ) ; \
PIOC->PIO_PUDR |= 0x000001FE; PIOC->PIO_IFDR |= 0x000001FE; PIOC->PIO_ODR |= 0x000001FE; PIOC->PIO_PER |= 0x000001FE; }
// When using the TFT breakout board, control pins are congurable.
#dene RD_ACTIVErdPort->PIO_CODR |= rdPinSet//PIO_Clear(rdPort, rdPinSet)
#dene RD_IDLErdPort->PIO_SODR |= rdPinSet//PIO_Set(rdPort, rdPinSet)
#dene WR_ACTIVEwrPort->PIO_CODR |= wrPinSet//PIO_Clear(wrPort, wrPinSet)
#dene WR_IDLEwrPort->PIO_SODR |= wrPinSet//PIO_Set(wrPort, wrPinSet)
#dene CD_COMMANDcdPort->PIO_CODR |= cdPinSet//PIO_Clear(cdPort, cdPinSet)
#dene CD_DATAcdPort->PIO_SODR |= cdPinSet//PIO_Set(cdPort, cdPinSet)
#dene CS_ACTIVEcsPort->PIO_CODR |= csPinSet//PIO_Clear(csPort, csPinSet)
#dene CS_IDLEcsPort->PIO_SODR |= csPinSet//PIO_Set(csPort, csPinSet)
#endif
#else
#endif
#if !dened(__SAM3X8E__)
// Stu common to all Arduino AVR board types:
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
// When using the TFT breakout board, control pins are congurable.
#dene RD_ACTIVE *rdPort &= rdPinUnset
#dene RD_IDLE *rdPort |= rdPinSet
#dene WR_ACTIVE *wrPort &= wrPinUnset
#dene WR_IDLE *wrPort |= wrPinSet
#dene CD_COMMAND *cdPort &= cdPinUnset
#dene CD_DATA *cdPort |= cdPinSet
#dene CS_ACTIVE *csPort &= csPinUnset
#dene CS_IDLE *csPort |= csPinSet
#endif
#endif
// Set value of 2 TFT registers: Two 8-bit addresses (hi & lo), 16-bit value
#dene writeRegisterPairInline(aH, aL, d) { \
uint8_t hi = (d) >> 8, lo = (d); \
CD_COMMAND; write8(aH); CD_DATA; write8(hi); \
CD_COMMAND; write8(aL); CD_DATA; write8(lo); }
#endif // _pin_magic_
Farrukh
February 2, 2015
Thanxs alott dear for giving us the library for 154 the lcd is now working perfectly accept the touchscreen,the example tft paint is still not working as the there is no
response from the touchscreen..
Jan
February 5, 2015
@Farrukh, you probably need to take the tftpaint (without shield), and change the pins for the touchscreen to the shield pinout.
Because while this looks like a shield to me, for the screen I had to leave the USE_ADAFRUIT_SHIELD_PINOUT commented out, but apparently the touchscreen does
have the shield pinning.
So in the tftpaint sketch, change:
#dene YP A3 // must be an analog pin, use An notation!
#dene XM A2 // must be an analog pin, use An notation!
#dene YM 9 // can be a digital pin
#dene XP 8 // can be a digital pin
to:
// These are the pins for the shield!
#dene YP A1 // must be an analog pin, use An notation!
#dene XM A2 // must be an analog pin, use An notation!
#dene YM 7 // can be a digital pin
#dene XP 6 // can be a digital pin
That worked for me.
Also I had to change the display height in Adafruit_TFTLCD.cpp
from:
#dene TFTHEIGHT 400
to:
#dene TFTHEIGHT 320
And to get tftbmp to work, removed the rst = false; line (line 205) from the sketch.
Jan
February 5, 2015
Just saw on github that the rst = false; line in tftbmp should not be removed, but that the bracketing in the pushColors function in Adafruit_TFTLCD.cpp was wrong.
The bracket on line 899 (after CS_IDLE) should in fact be placed on line 889 (before CD_DATA).
Farrukh
February 8, 2015
Thanks for the reply buddy,but i got it solved still needs some calibration although
Nir
February 13, 2015
Hi
i use this shield to display numbes the came from sensor
i try to make the touch screen button in order to turn on and o led
when i insert the touch screen command TSPoint p = ts.getPoint(); ,
the numbers stop to update on the screen,
how can i keep the numbers update and still make button from the screen?
Sru
February 19, 2015
Hi,
I too used this LCD tft to display the data from the sensor..used the library from
https://github.com/Smoke-And-Wires/TFT-Shield-Example-Code/tree/master/SWTFT-Shield
I am getting the right values displayed but in mirrored form.Used the same library to display a string and its displayed properly. Is it nythng to do with the
tft.setRotation function? without using this function i m not getting the sensor values displayed but if used its giving mirrored values. someone lease help me
regarding this.
Nagesh
March 3, 2015
Hello All,
I am Nagesh and newbie in Arduino. I found this post useful to show info on TFT display. The library is working with UNO where as the same is failing with Arduno Yun.
Program complies but there is blank display. I couldnt gure out cause and solution for the same.
I found Andrea, Leonardo Kusch and Manoj Vora faced the same problem above and L Mitchell recommended to use SPI. To be honest I am not able to understand on
HOW TO part. I request you to share the connection diagram and sample program (if any). Unfortunately there is very less documentation on this TFT display (by
mcufriend.com), so your comments would be helpful.
Thanks in advance.
I think valid share, I had the same problem with mirror image, through brute strength and patience, I was changing dword and succeeded, UTFT \ tft_drivers \
spfd5408a \ initlcd.h change in the Control Panel value LCD_Write_COM_DATA (0x90, 0x0010); to the value LCD_Write_COM_DATA (0x90, 0x0033); and be happy
varun
April 6, 2015
sir can please provide a link to any sample application you have created on this screen it would be helpful to learn the syntax because of a lot of confusion over this
touchscreen .
rob v
April 7, 2015
C:\Users\vermillionr\Documents\Arduino\libraries\TFTLCD\glcdfont.c:9:23: error: variable font must be const in order to be put into read-only section by means of
__attribute__((progmem))
static unsigned char font[] PROGMEM = {
^
Error compiling.
Does anyone know why this error is occurring?
Jon RD
April 27, 2015
In the declaration, I popped the word const before the word char and it looks to have worked.
Alastair
April 27, 2015
Hi, Could you elaborate where you popped the constant at? in glcdfont.c or in the examples them self?
Much thanks
Gunner
May 22, 2015
After much trial and error, I opened glcdfont.c (in the TFTLCD library) with NOTEPAD (or use any text editor) and popped the word const in front of the only existing
word char that I could nd In the rst line of code the rest looked like hex.
fodinabor
April 9, 2015
Hey,
I got this display.. and well Im not happy but it works to the widest extent except that I have a white bar on the left side I had this with a display of the same series,
too but I sent that back.. now Im still stuck with that issue .. can some one help me?
NK
May 21, 2015
PLZ help
plz help
wjj
June 15, 2015
My screen shield chip ID showing 0x6767 , the TFT screen always showing blank. not working with any code
Tom
July 25, 2015
Does anyone know how i can gain use of digital pin 2, i need pin 2 for another circuit connected to my uno that counts pulses from a geiger tube. ive tried using jumpers
and removing them one by one but the only pins free are 10 to 13 beacuse i wont be using the sd
Nick
August 11, 2015
Of course it could be argued that youre enabling me as a lazy b***ard who should really gure these things out for myself?
Tony
August 19, 2015
Hello Justin,
after being crazy for about a month I nd your work and in a moment everything is working perfectly. Thank you, thank you very much.
Now I would have the following question
if you wanted to use the display to view the time from an RTC like I should change the code to release the analog pin 4 as RTC uses pins A4 and A5 as SCL and SDA?
I have adapted the LCD_ID_Reader code to work on an STM32L152RE. I am using Atollic trueSTUDIO. The lcd has MCU Friend printed on it and the controller is
ST7781 according to the Ebay seller. The ID seems to be C505.
My question is: How long does lling the screen usually take? For me it takes approximately 1 second per pixel, which seems slow to me.
Peter
September 6, 2015
I am jealous I have the same screen, had high hopes, and I get a white screen.
Nicolas
November 1, 2015
Hi Justin, Guys,
I bought one of these screens a while back but never got it to work except for the backlight.
I tried your graphicstest example where I replaced the #include TFTLCD.h by #include and changed the type of font[] to const to be able to compile (Arduino IDE). I
still have a simple white screen.
Could someone provide me with the simple sketch they can think of just to see if I can display a few pixels on the screen?
ds1lmp
November 19, 2015
//
Thank`s a lot.
your
ds1lmp
edgar
November 25, 2015
it is loading images very slow and I want to make it faster but have no idea on how to do this
edgaromar
November 25, 2015
it is loading images very slow and I want to make it faster but have no idea on how to do this