• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
TFT nie hasa
#1
-Arduino uno
-TFT 2,4'' lcd Shield

  Witam. Mam taki problem. Zakupiłem wyświetlacz z dotykiem i chciałem trochę poeksperymentować z nim. 
 I tu pojawił się problem. Po złączeniu płytek i podłączeniu do kompa wyświetlacz zaświecił się na biało poczym zacząłem wgrywać jakiegoś gotowca z bibliotek. Nawet kilka pobrałem z neta. Niestety  wyświetlacz nadal biały. 
Moje pytanie jest takie:
  czy musi w nim być zainstalowana karta sd żeby odpalil?
  czy potrzebuje on jakiegoś adresu tak jak w przypadku I2C?
  czy może jakaś konkretna biblioteka jest potrzebna?
  co ewentualnie jest nie tak że nie chce się uruchomić.
Proszę o pomoc. Walczę już z tym 2 dni bez rezultatów.
Pozdrawiam.
 
Odpowiedź
#2
Witam,

Spróbuj wgrać tego sketcha - moja kompilacja Smile
Oprócz testu ekranu, testuje również dotyk na ekranie wyświetlając współrzędne.

Spróbuj również wgrać najpierw sketcha do UNO bez zamontowanego TFT.
I dopiero po wgraniu włożyć TFT (oczywiście na wyłączonym ARDUINO)
Chociaż u mnie wgrywa się bez problemu razem z schieldem...

Pozdr.

Kod:
// HELLO WORLD

#include <SPFD5408_Adafruit_TFTLCD.h>
#include <SPFD5408_TouchScreen.h>

#define YP A2
#define XM A3
#define YM 8  
#define XP 9

#define MINPRESSURE 250
#define MAXPRESSURE 350

TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4

#define BLACK   tft.color565(0,0,0)
#define RED     tft.color565(255,0,0)
#define GREEN   tft.color565(0,255,0)
#define BLUE    tft.color565(0,0,255)
#define WHITE   tft.color565(255,255,255)

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

//----------------------------------Ustawienia programu -----------------------------------------
void setup(void)
{
 Serial.begin(9600);

 tft.reset();
 tft.begin(0x9341); // SDFP5408
 tft.setRotation(3);
 tft.fillScreen(BLACK);

 testText();

 tft.drawLine(0, 0, 319, 0, GREEN);
 tft.drawLine(0, 239, 319, 239, GREEN);
 tft.drawLine(0, 0, 0, 239, GREEN);
 tft.drawLine(319, 0, 319, 239, GREEN);
}

//--------------------------------- Pętla główna programu ----------------------------------------
void loop(void)
{
 TSPoint p = ts.getPoint();

 if (p.z > 0)
 {
   Serial.print(p.x);
   Serial.print(" ");
   Serial.print(p.y);
   Serial.print(" ");
   Serial.print(p.z);
   Serial.println();
 }

 pinMode(XM, OUTPUT);
 pinMode(YP, OUTPUT);

 if(p.z > 0)
 {
   tft.fillScreen(BLACK);
   testText();

   tft.setTextColor(WHITE);  
   tft.setTextSize(3);

   tft.setCursor(80, 120);
   tft.print("p.x = ");
   tft.println(p.x);

   tft.setCursor(80, 150);
   tft.print("p.y = ");
   tft.println(p.y);

   tft.drawLine(65, 110, 250, 110, WHITE);
   tft.drawLine(65, 185, 250, 185, WHITE);
   tft.drawLine(65, 110, 65, 185, WHITE);
   tft.drawLine(250, 110, 250, 185, WHITE);
 }
}

//----------------------------------------------- testText -----------------------------------------
unsigned long testText()
{
 tft.fillScreen(BLACK);

 tft.setTextColor(WHITE);  
 tft.setTextSize(4);
 tft.setCursor(0, 20);
 tft.println(" Hello World!");

 tft.setTextColor(RED);
 tft.setTextSize(2);
 tft.setCursor(5, 80);
 tft.println("ARDUINO SHIELD LCD TFT 2.4");

 tft.setCursor(220, 225);
 tft.setTextColor(BLUE);  
 tft.setTextSize(1);
 tft.println("ZERO Point --->");
}

//------------------------------------------ TSPoint waitOneTouch -----------------------------------
TSPoint waitOneTouch()
{
 TSPoint p;

 do
 {
   p= ts.getPoint();
   pinMode(XM, OUTPUT);
   pinMode(YP, OUTPUT);
 }
 while((p.z < MINPRESSURE ) || (p.z > MAXPRESSURE));

 return p;
}
Jeżeli pomogłem, to poproszę o punkt reputacji Big Grin
 
Odpowiedź
#3
Wgrałem ale wywala błąd kompilacji.
 
Odpowiedź
#4
(13-10-2016, 21:44)ferdricco napisał(a): Wgrałem ale wywala błąd kompilacji.

Sprawdziłem u mnie i kompiluje się bez problemów.

Ja mam stare IDE w wersji 1.0.5-r2
A jakie masz Ty?
Może w tym jest problem...

Pzdr.
Jeżeli pomogłem, to poproszę o punkt reputacji Big Grin
 
Odpowiedź
#5
(14-10-2016, 15:36)ANT napisał(a):
(13-10-2016, 21:44)ferdricco napisał(a): Wgrałem ale wywala błąd kompilacji.

Sprawdziłem u mnie i kompiluje się bez problemów.

Ja mam stare IDE w wersji 1.0.5-r2
A jakie masz Ty?
Może w tym jest problem...

Pzdr.
Nie wiem od czego zacząć ale jak to mówią najlepiej od początku.
Uninstal Arduino IDE, następnie usuń z katalogu moje dokumentyty cały podkatalog arduino, wejdź na stronę arduino.cc
uruchom instalację ze strony(nie pobieraj  zipa)następnie pobierz to archiwum
.zip   LCD_ID_Reader.zip (Rozmiar: 2.94 KB / Pobrań: 29) otwórz z poziomu pakowarki(winrar ,winzip ...itp)plik ino i załaduj do uno czy co tam masz i odpal monitor portu szeregowego.
otrzymasz info o sterowniku na jakim pracuje wyświetlacz. Będziesz wiedział jakich bibliotek używać.
Mój 2,4 sterowanie równoległe ma ili9325 i adafruit gfx zasówa jak nvidia. Tyle na początek, a spakowanych bibliotek mam już tyle, że zaczynam się w tym gubić.
 
Odpowiedź
#6
Niewiem oco chodzi ale wyskakuje mi takie cosik.
tftpaint_shield.ino:14:3: error: #error "This sketch is intended for use with the TFT LCD Shield. Make sure that USE_ADAFRUIT_SHIELD_PINOUT is #defined in the Adafruit_TFTLCD.h library file."
 
Odpowiedź
#7
(16-10-2016, 20:36)ferdricco napisał(a): Niewiem oco chodzi ale wyskakuje mi takie cosik.
tftpaint_shield.ino:14:3: error: #error "This sketch is intended for use with the TFT LCD Shield. Make sure that USE_ADAFRUIT_SHIELD_PINOUT is #defined in the Adafruit_TFTLCD.h library file."

ferdricco chyba się nie zrozumieliśmy.
Jeszcze raz od początku, czy odinstalowałeś arduino ide?,czy zainstalowałeś je na nowo jak podałem w poprzednim poście?
Plik , który wrzuciłem to programik do odczytania sterownika w tft i uruchamia się tak jak podałem wyżej.
w paczce tej jest plik z rozszerzeniem xxxx.ino, klikasz plik i arduino ide odpali się automatycznie,potem klikasz ikonke kompiluj i wgraj w konsoli arduino ide i po wgraniu otwórz monitor portu szeregowego i tam otrzymasz informację o sterowniku jaki jest zamontowany w twoim tft.
To co podałeś teraz to po prostu kompilowałeś plik tftpaint_shield, który jest przeznaczony dla produktu adafruit shield
a nie dla twojego tft bo to inna pinologia jest .
Jak odpalisz ten plik id reader to wrzuć do posta to co otrzymałeś w monitorze rs.
życze owocnej pracy i pozdrawiam
 
Odpowiedź
#8
https://forum.arduino.cc/index.php?topic=366304.0
plik MCUFREND_kbv 2.9.zip ściągnij i dodaj bibliotekę do ardu.ino potem sketch paint
 
Odpowiedź
#9
Witam,
mnie w monitorze portu szeregowego pokazuje:

Initializing LCD...
Reading ID...0x8484
Loading LCD registers...
Filling the screen...
Done filling...
If your screen filled red, you may be able to use the library at http://misc.ws

i biały ekran. niestety nie wiem co to jest za driver ID...0x8484.

jednak mój LCD podłączany jest nieco inaczej (pod m2560) wszystkie sygnały sterujące oraz danych są na wyprowadzeniach gdzieś od 22 do 53 (niestety nie mam dokumentacji do tego wyświetlacza i nie  wiem jaki jest pinouts).  w "programie testowym" jest opisane że wyprowadzenia są następujące:
#define LCD_RST A4
#define LCD_CS A3
#define LCD_RS A2
#define LCD_WR A1
#define LCD_RD A0

#define LCD_D0 8
#define LCD_D1 9
#define LCD_D2 2
#define LCD_D3 3
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7

natomiast ja nie mam złącza wyprowadzonego pod wyjścia analogowe a pod wyprowadzenia od 0 do 7 podłączony jest panel dotykowy na XPT2046.

[Obrazek: HTB1eefhLpXXXXawXFXXq6xXFXXXY.jpg?size=5...5e704b728e]

[Obrazek: HTB1ECPXLpXXXXaSXVXXq6xXFXXXY.jpg?size=6...774c5ff744]

Czy ktoś dysponuje jakimiś przykładami bądź dokumentacją tego wyświetlacza?

dzięki za pomoc
pozdrawiam
 
Odpowiedź
#10
witam 
do prawidłowego działania  lcd_id_reader potrzeba w liniach define podstawić te z kodu poniżęj
Kod:
// Paint example specifically for the TFTLCD breakout board.
// If using the Arduino shield, use the tftpaint_shield.pde sketch instead!
// DOES NOT CURRENTLY WORK ON ARDUINO LEONARDO

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <TouchScreen.h>

#if defined(__SAM3X8E__)
   #undef __FlashStringHelper::F(string_literal)
   #define F(string_literal) string_literal
#endif

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8  (Notice these are
//   D1 connects to digital pin 9   NOT in order!)
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7

// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).
//   D0 connects to digital pin 22
//   D1 connects to digital pin 23
//   D2 connects to digital pin 24
//   D3 connects to digital pin 25
//   D4 connects to digital pin 26
//   D5 connects to digital pin 27
//   D6 connects to digital pin 28
//   D7 connects to digital pin 29

// For the Arduino Due, use digital pins 33 through 40
// (on the 2-row header at the end of the board).
//   D0 connects to digital pin 33
//   D1 connects to digital pin 34
//   D2 connects to digital pin 35
//   D3 connects to digital pin 36
//   D4 connects to digital pin 37
//   D5 connects to digital pin 38
//   D6 connects to digital pin 39
//   D7 connects to digital pin 40

#define YP A3  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 9   // can be a digital pin
#define XP 8   // can be a digital pin

#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// optional
#define LCD_RESET A4

// Assign human-readable names to some common 16-bit color values:
#define    BLACK   0x0000
#define    BLUE    0x001F
#define    RED     0xF800
#define    GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF


Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

#define BOXSIZE 40
#define PENRADIUS 3
int oldcolor, currentcolor;

void setup(void) {
 Serial.begin(9600);
 Serial.println(F("Paint!"));
 
 tft.reset();
 
 uint16_t identifier = tft.readID();

 if(identifier == 0x9325) {
   Serial.println(F("Found ILI9325 LCD driver"));
 } else if(identifier == 0x9328) {
   Serial.println(F("Found ILI9328 LCD driver"));
 } else if(identifier == 0x7575) {
   Serial.println(F("Found HX8347G LCD driver"));
 } else if(identifier == 0x9341) {
   Serial.println(F("Found ILI9341 LCD driver"));
 } else if(identifier == 0x8357) {
   Serial.println(F("Found HX8357D LCD driver"));
 } else {
   Serial.print(F("Unknown LCD driver chip: "));
   Serial.println(identifier, HEX);
   Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:"));
   Serial.println(F("  #define USE_ADAFRUIT_SHIELD_PINOUT"));
   Serial.println(F("should appear in the library header (Adafruit_TFT.h)."));
   Serial.println(F("If using the breakout board, it should NOT be #defined!"));
   Serial.println(F("Also if using the breakout, double-check that all wiring"));
   Serial.println(F("matches the tutorial."));
   return;
 }

 tft.begin(identifier);

 tft.fillScreen(BLACK);

 tft.fillRect(0, 0, BOXSIZE, BOXSIZE, RED);
 tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, YELLOW);
 tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, GREEN);
 tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, CYAN);
 tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, BLUE);
 tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, MAGENTA);
 // tft.fillRect(BOXSIZE*6, 0, BOXSIZE, BOXSIZE, WHITE);

 tft.drawRect(0, 0, BOXSIZE, BOXSIZE, WHITE);
 currentcolor = RED;

 pinMode(13, OUTPUT);
}

#define MINPRESSURE 10
#define MAXPRESSURE 1000

void loop()
{
 digitalWrite(13, HIGH);
 TSPoint p = ts.getPoint();
 digitalWrite(13, LOW);

 // if sharing pins, you'll need to fix the directions of the touchscreen pins
 //pinMode(XP, OUTPUT);
 pinMode(XM, OUTPUT);
 pinMode(YP, OUTPUT);
 //pinMode(YM, OUTPUT);

 // we have some minimum pressure we consider 'valid'
 // pressure of 0 means no pressing!

 if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
   /*
   Serial.print("X = "); Serial.print(p.x);
   Serial.print("\tY = "); Serial.print(p.y);
   Serial.print("\tPressure = "); Serial.println(p.z);
   */
   
   if (p.y < (TS_MINY-5)) {
     Serial.println("erase");
     // press the bottom of the screen to erase
     tft.fillRect(0, BOXSIZE, tft.width(), tft.height()-BOXSIZE, BLACK);
   }
   // scale from 0->1023 to tft.width
   p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
   p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
   /*
   Serial.print("("); Serial.print(p.x);
   Serial.print(", "); Serial.print(p.y);
   Serial.println(")");
   */
   if (p.y < BOXSIZE) {
      oldcolor = currentcolor;

      if (p.x < BOXSIZE) {
        currentcolor = RED;
        tft.drawRect(0, 0, BOXSIZE, BOXSIZE, WHITE);
      } else if (p.x < BOXSIZE*2) {
        currentcolor = YELLOW;
        tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, WHITE);
      } else if (p.x < BOXSIZE*3) {
        currentcolor = GREEN;
        tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, WHITE);
      } else if (p.x < BOXSIZE*4) {
        currentcolor = CYAN;
        tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, WHITE);
      } else if (p.x < BOXSIZE*5) {
        currentcolor = BLUE;
        tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, WHITE);
      } else if (p.x < BOXSIZE*6) {
        currentcolor = MAGENTA;
        tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, WHITE);
      }

      if (oldcolor != currentcolor) {
         if (oldcolor == RED) tft.fillRect(0, 0, BOXSIZE, BOXSIZE, RED);
         if (oldcolor == YELLOW) tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, YELLOW);
         if (oldcolor == GREEN) tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, GREEN);
         if (oldcolor == CYAN) tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, CYAN);
         if (oldcolor == BLUE) tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, BLUE);
         if (oldcolor == MAGENTA) tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, MAGENTA);
      }
   }
   if (((p.y-PENRADIUS) > BOXSIZE) && ((p.y+PENRADIUS) < tft.height())) {
     tft.fillCircle(p.x, p.y, PENRADIUS, currentcolor);
   }
 }
}


Ten kod też możesz wykorzystać. Pinologia do mega jest zaznaczona.

Pozdrawiam i powodzenia
 
Odpowiedź
  


Skocz do:


Przeglądający: 1 gości