Hello, everyone,
I have recently bought a couple of LCD TFT touchscreen shields from ebay:
2-8-Inch-TFT-LCD-Display-Touch-Screen-Module-with-SD-Solt-for-Arduino-UNO-TOP
This seemed to be a good choice (not too expensive) for a guy with no previous experience with lcd displays.
However (suprise?..), it seems that I can't get it work properly. Before posting here, I did some research and tried a few different libraries.
My setup
Hardware:
- ARDUINO UNO (atmega 328p-pu chip)
- LCD TFT touchsreen shield - according to http://www.mcufriend.com/products.htm , the chip for this lcd is st7781
Software:
- Arduino IDE 1.0.6
- Libraries:
libraries.7z
st7783.zip
and a few other (can't remember the links)
Unfortunately, all of them didn't work as expected. The majority of them showed white screen:
st7783 library seemed to at least be doing something:
After using an example "st7783->Mygraphicstest", the screen changed from white to "striped" (periodic display of white and dark lines), which seemed to be refreshing (perhaps responding to the commands from the example sketch). To confirm this, I removed all the commands in loop and setup, except from "tft.fillScreen(BLUE)". After this, at first the screen turned white, refreshed (blinked) and turned striped (and stayed that way, no more refreshing). Changing the filling color did absolutely nothing (at least visible to me), so even though the program is trying to do something, the lcd display chip doesn't interpret it right (?).
So I thought maybe you guys have any ideas what could be causing this (because from the posts I've read before, many people are using similar displays). Following the steps from other posts, I couldn't get it working (and never saw a problem like I have).
I'm trying to read the st7783 chip manual (believing the seller's website), but it's a lot of info to grasp for a beginner with LCDs. So maybe you could point me in a right direction (or maybe provide a solution?).
I believe the pinning is correct as I'm using a shield.
So...
- Timing issues between arduino and lcd chip? How to solve it if that's the case? Or how to debug it?
- Incorrect initialization of the lcd chip? How to check it?
- Incorrect commands being sent (every second line filled, creating a striped pattern)?
- Maybe the pins are actually incorrect, even though it's a shield?
- Defective lcd? Tried both of them, but none works as expected
- More ideas?
I believe you people have more experience with this kind of stuff and could help me (and possibly others with similar issues).
The code with which I get a non-refreshing striped screen (using st7783 library):
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// you can also just connect RESET to the arduino RESET pin
#define LCD_RESET A4
//Duemilanove/Diecimila/UNO/etc ('168 and '328 chips) microcontoller:
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#include "TFTLCD.h"
TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
void setup(void) {
Serial.begin(9600);
Serial.println("8 Bit LCD test!");
uint16_t identifier = tft.readRegister(0x00);
Serial.print("ID=");
Serial.println(identifier, HEX);
Serial.println("tft.initDisplay");
tft.reset();
delay(100); // ???
tft.initDisplay();
Serial.println("fillscreen");
tft.fillScreen(BLUE);
}
void loop(void) {
}
The result displayed on serial port:
8 Bit LCD test!
ID=0
tft.initDisplay
fillscreen
I'm sorry if this seems an easy task for you guys (or maybe I've made an obvious mistake), but pardon the beginner his mistakes!
Thank you for your time!
UPDATE ON: 2015-01-20
Wasn't really able to catch up with these posts (exams, work and stuff), but this post got my tft working:
http://forum.arduino.cc/index.php?topic=292777.0
Not much time to go this through right now, but will surely find out what was missing in my code
Thank you!