TFT doesn't work well

Hello, my TFT01 (controller S6D1121) doesn't work well. I use it with an arduino due (via USB) and a Arduino Mega shield v2.0. I made the calibration of the touch screen several times, but it still doesn' t work well. More precisely, if I press on a button that I have created nothing happens while if I press on empty happens what should happen if I press the button. I have changed the settings on the sketch

UTFT myGLCD (TFT01_32,38,39,40,41);
UTouch myTouch (6,5,4,3,2);
UTFT_myButtons (&myGLCD, &myTouch);

Help me please!!

If you are sure you mean what you say, using a Mega shield on an Arduino DUE? That is probably contributing to your problems, the Mega being a 5V device, the DUE being a 3V device, and many TFT being 3V devices, there is level shifting on the Mega shield which is not needed when connected to a DUE.

Regards,

Graham

What do your raw touch values return when you touch the screen? If your screen is 240x320, and the values your getting are greater then your screen resolution, then this could be the issue.

I have done a new calibration and on the Serial monitor appears this:

#define CAL_X 33474555
#define CAL_Y 34703434
#define CAL_S 2148790511

What does it mean??

That info should be showing up on the TFT not the serial monitor.
Just follow the rest of the instructions during calibration which tells you to replace the values in UTouchCD.h file with the calibrated ones.
The UTouchCD.h file is in the UTouch library folder.

I've changed the values on the file UTouchCD.h several times, but nothing changed. I also made the adjustment to the contrary and the heads swapped.

I don't know if it will fix anything, but perhaps you should put back the UL suffix.

#define CAL_X 33474555UL[color=#222222][/color]
#define CAL_Y 34703434UL[color=#222222][/color]
#define CAL_S 2148790511UL

Do this. Make a simple sketch that shows the touch points on screen, and then touch the screen is various places like the corners and center. The corners should be something like (0, 0) : (0, 240) : (320, 0) and (320, 240) with center being close to (160,120).

Thank you very much!!1
I made this sketch for the coordinates:

#include <UTFT.h>
#include <UTouch.h>
UTFT    myGLCD(TFT01_32,38,39,40,41);UTouch  myTouch( 6, 5, 4, 3, 2);

void setup()
{
  Serial.begin(9600);
  myGLCD.InitLCD();
  myGLCD.clrScr();

  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);

   
}

void loop()
{
   long x, y;
  
  while (myTouch.dataAvailable() == true)
  {
    myTouch.read();
    x = myTouch.getX();
    y = myTouch.getY();
   
    Serial.print("x= ");
    Serial.println(x);
    Serial.print("y= ");
    Serial.println(y);
    Serial.print("\n");
  }
}

But the coordinates are inverted, but I don’t know why.
There are the coordinates:
top left corner (0,0);
top right corner (0,239);
bottom left corner (319,0);
bottom right corner (319,239);

Only the coordinates of two corners (I suppose the top left corner and bottom right corner) are accurate. The coordinates of the remaining corners are inverted. In addition if I press on the centre of the touch the coordinates are the same of one of the corner.

But the coordinates are inverted

How so? (0, 0) ---------------------------------------(320, 0) | | | | | | | (0, 240)------------------------------------(320, 240)

No, the situation is the following (landscape orientation):

(0,0)----------------(0,239) | | | | (319,0)---------(319,239)

Moreover, these are the only 4 coordinates shown, anywhere I press on the screen. It's like as the screen was divided into 4 invisible blocks, and the coordinates shown of a random point are the ones of the closer corner of the point itself:


| A | B |

| C | D |

Anywhere I press in "A" area, it shows (0,0), anywhere I press in "B" area, it shows (0,239), and so on.

Try these and re-calibrate.

define CAL_X 0x00378F66UL

define CAL_Y 0x03C34155UL

define CAL_S 0x000EF13FUL

Hazardsmind,

Sorry to jump in, you are doing a sterling effort, but we appear to have overlooked something fundamental…

fs10:
Hello,
my TFT01 (controller S6D1121) doesn’t work well.
I have changed the settings on the sketch

UTFT myGLCD (TFT01_32,38,39,40,41);

UTouch myTouch (6,5,4,3,2);
UTFT_myButtons (&myGLCD, &myTouch);

Either the display is a TFT01_32 OR controller S6D1121. Which is it?

Did either of you read UTFT_Supported_display_modules_&_controllers.pdf?

Regards,

Graham

There is not much difference, except the models transfer modes.

TFT01_32: 320x240 16Bit vs. S6D1121_8: 320x240 8Bit S6D1121_16: 320x240 16Bit

He might have an 8Bit model, so the OP will need to use S6D1121_8, instead of TFT01_32.

HazardsMind: There is not much difference, except the models transfer modes.

There is a HUGE difference, namely the controller.... TFT01_32 being SSD1289, not S6D1121 as OP states.

Graham

True.

But I was only referring to the screen sizes and not the initializing functions because the screen does work (kinda). Anyway, the touchscreen is separate from the actual screen, so it doesn't rely on the model number to work. It just needs to be properly calibrated which doesn't seem to be working.

@fs10 Draw a rectangle on the screen with coords myGLCD.fillRect(0,0,320,240), and see if it spans the entire screen or to just one portion of the screen.

This will tell you if the model you entered is correct or not.

You are right of course, but I am still fairly sure it is because he is using a Mega shield on a Due, bear with me , I will do exactly that!!

Got errands to run first, will post back the results later.

Regards,

Graham

he is using a Mega shield on a Due

That could be it too. I don't have a Due, or that Mega shield, so I can't rule them out for myself.

I just get the backlight lit, but no display on screen, so cannot rule it out as the reason for poor calibration of touch.

I have no further ideas.

Regards,

Graham

Good morning,
I tried to declare it as S6D1121_8 and S6D1121_16 but the screen is ever white. It works only if it is declared as a TFT01_32. I used also an arduino mega but nothing changed. I tried to create a rectangle using myGLCD.drawRect(0,0,319,239); and the rectangle spans the entire screen. I used these on file UTouchCD.h:
#define CAL_X 0x00378F66UL
#define CAL_Y 0x03C34155UL
#define CAL_S 0x000EF13FUL
and I re-calibrated the touch. Now the coordinates are exact. Now the touch works well. But now the problem is the following: it can only press a number of times the touch, then the touch does not work. Why this?

post your current sketch.