Author Topic: NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem  (Read 4165 times)

hbcelebi

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem
« on: December 09, 2014, 03:21:01 AM »
Hello all,
 
I connected my PIC32 with a NHD‐2.4‐240320SF‐CTXL#‐FTN1.
I do not have touch controller. Instead I am using the ADCs of PIC.
I was trying to handle the touch screen controller with a basic test code. I get the sampling points from ADC for all values, like X and Y coordinate, Z1 and standby values.
I wrote a simple test program which firstly makes a 5 point calibration, then draws the point that I touched on the screen.
Interesting things happened then.
As you see in the image attached, there is a region on the screen where I cannot touch at all (of course I can physically touch but I get the pixel values out of the region). It looks like a plus sign. I re-checked my code and the calibration values. Everything seems fine. Out of the untouchable(!) region, things works fine and smooth.
BTW, LCD works fine. I can draw a full-size png file without any problem.

 
What could be the reason?

hbcelebi

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem
« Reply #1 on: December 10, 2014, 02:23:20 AM »
No one has any idea?

This is not a calibration problem. Out of the untouchable region everything works fine. I can even write or draw.
But when I touch at the untouchable region (!), it occurs either at the left or the reight hand side of the region.

I think this is because of the touch screen system inside LCD. I am not an expert on LCDs or touch screens, so I cannot tell the exact problem. But it seems like something is wrong.

In order to see the voltage values while sampling X coordinate, I connected the YU (Y-) pin to the oscillator and get some results. Please have a look at the attached images;
1.jpg - Sampling right hand side of the untouchable region. Everything seems OK. YU acts like a square wave while sampling.
2.jpg - Sampling left hand side of the untouchable region. OK but YU (Y-) decays like an exponential.
3.jpg - Sampling on the untouchable region. I think problem occurs because of the mixture of square wave and exponential decaying.

Any idea?
« Last Edit: December 10, 2014, 02:30:40 AM by hbcelebi »

hbcelebi

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem
« Reply #2 on: December 10, 2014, 02:30:56 AM »
3.jpg

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem
« Reply #3 on: December 10, 2014, 08:36:41 AM »
Do you have another display to try?  I'm curious to see if this is also occurring on another display, and if the "untouchable region" remains the same or changes.
If you do, please try it and let me know.  If you do not have another to try, you may either try purchasing another one to test, or emailing quality@newhavendisplay.com to set up an RMA.
« Last Edit: December 10, 2014, 08:38:50 AM by Michael_L »

hbcelebi

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem
« Reply #4 on: December 10, 2014, 09:56:37 AM »
Thanks for your reply,

Yes I have a couple of LCDs. And yes I tried changing it. And yes it remains at the same place.
I make 5 point calibration based on TI's "Calibration in Touch Screen Systems" document.
Code: [Select]
void touch_Screen_Calibrate( void )
{
   ... // 5 point calibration
}

void touch_Screen_Calibration_Calculate(int x1, int x2, int x3, int x4, int x5,
        int y1, int y2, int y3, int y4, int y5)
{
    double a = 0, b = 0, c = 0, d = 0, e = 0, n = 0,
            X1 = 0, X2 = 0, X3 = 0, Y1 = 0, Y2 = 0, Y3 = 0,
            det = 0, detX1 = 0, detX2 = 0, detX3 = 0, detY1 = 0, detY2 = 0, detY3 = 0;
    a = x1*x1 + x2*x2 + x3*x3 + x4*x4 + x5*x5;
    b = y1*y1 + y2*y2 + y3*y3 + y4*y4 + y5*y5;
    c = x1*y1 + x2*y2+ x3*y3 + x4*y4 + x5*y5;
    d = x1 + x2 + x3 + x4 + x5;
    e = y1 + y2 + y3 + y4 + y5;
    n = 5;
    X1 = x1*CAL_POINT_X1 + x2*CAL_POINT_X2 + x3*CAL_POINT_X3 + x4*CAL_POINT_X4 + x5*CAL_POINT_X5;
    X2 = y1*CAL_POINT_X1 + y2*CAL_POINT_X2 + y3*CAL_POINT_X3 + y4*CAL_POINT_X4 + y5*CAL_POINT_X5;
    X3 = CAL_POINT_X1 + CAL_POINT_X2 + CAL_POINT_X3 + CAL_POINT_X4 + CAL_POINT_X5;
    Y1 = x1*CAL_POINT_Y1 + x2*CAL_POINT_Y2 + x3*CAL_POINT_Y3 + x4*CAL_POINT_Y4 + x5*CAL_POINT_Y5;
    Y2 = y1*CAL_POINT_Y1 + y2*CAL_POINT_Y2 + y3*CAL_POINT_Y3 + y4*CAL_POINT_Y4 + y5*CAL_POINT_Y5;
    Y3 = CAL_POINT_Y1 + CAL_POINT_Y2 + CAL_POINT_Y3 + CAL_POINT_Y4 + CAL_POINT_Y5;
    det = n*(a*b-c*c) + 2*c*d*e - a*e*e - b*d*d;
    detX1 = n*(X1*b-X2*c) + e*(X2*d-X1*e) + X3*(c*e-b*d);
    detX2 = n*(X2*a-X1*c) + d*(X1*e-X2*d) + X3*(c*d-a*e);
    detX3 = X3*(a*b-c*c) + X1*(c*e-b*d) + X2*(c*d-a*e);
    detY1 = n*(Y1*b-Y2*c) + e*(Y2*d-Y1*e) + Y3*(c*e-b*d);
    detY2 = n*(Y2*a-Y1*c) + d*(Y1*e-Y2*d) + Y3*(c*d-a*e);
    detY3 = Y3*(a*b-c*c) + Y1*(c*e-b*d) + Y2*(c*d-a*e);
    alpha_X = detX1 / det;
    beta_X = detX2 / det;
    det_X = detX3 / det;
    alpha_Y = detY1 / det;
    beta_Y = detY2 / det;
    det_Y = detY3 / det;
}
Then I get
alpha_X = -0.271
beta_X = -0.011
det_X = 268.399
alpha_Y = -0.005
beta_Y = -0.339
det_Y = 349.629
And this is the code while printing the touch points on screen
Code: [Select]
void debug_print_touch_points(int x_val, int y_val)
{
    ...
    x = ( alpha_X * (double)x_val ) + ( beta_X * (double)y_val ) + det_X;
    y = ( alpha_Y * (double)x_val ) + ( beta_Y * (double)y_val ) + det_Y;
    xi = (int)floor(x); yi = (int)floor(y);
    Draw_One_Pixel(xi, yi, YELLOW());
}
Things are very smooth outside the "untouchable region". I can write, draw etc.
I also double checked the code.

Is this sth about the product? Or is this a special case for resistive touch screens?
« Last Edit: December 10, 2014, 10:00:07 AM by hbcelebi »

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem
« Reply #5 on: December 10, 2014, 11:19:05 AM »
I haven't seen this issue, nor have I heard any customers asking about it as of yet.  The fact that you have multiple displays makes it very doubtful that it has to do with a defective display.  Also, since the "untouchable region" pattern shown on the display is the same from display to display, it makes it even more unlikely.  I'm guessing it is something with your software (I know it works everywhere else but that doesn't mean there is some anomaly or special case happening in those areas).  Do you have a resistive touch panel controller IC you could try using instead of handling it manually via software?

 

Problem setting "function select c" register

Started by jonmon6691Board OLEDs

Replies: 3
Views: 2275
Last post May 04, 2016, 02:44:37 PM
by Saurabh_B
NHD-4.3-480800EF-CTXP#-T - HX8369 continious memory write problem

Started by Henning_SBoard TFTs

Replies: 3
Views: 3583
Last post September 17, 2014, 06:51:40 AM
by Henning_S
NHD-1.8-128160EF-CTXI# problem: becomes pale after using it for some time

Started by fvdhoefBoard TFTs

Replies: 1
Views: 2941
Last post July 31, 2014, 08:55:40 AM
by Michael_L
NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem

Started by gnyturanBoard Character LCDs

Replies: 6
Views: 3226
Last post October 29, 2015, 01:23:58 PM
by Saurabh_B
NHD-C0220BiZ-FSW-FBW-3V3M Problem -- Doesn't power on

Started by seilcompBoard Character LCDs

Replies: 6
Views: 3030
Last post December 10, 2015, 08:07:52 AM
by Paul_B