0
\$\begingroup\$

Edit: sussed it, largely to help below. It turns out, screen X/Y do not have to correlate to touch sensor X/Y and, even more strangely, the touch resolution does not necessarily match screen resolution! The latter was really borking things up due to a fudge in the old screen that was being replaced having higher touch resolution than screen.

Sorry in advance, this is long. I am very experience embedded engineer, done some basic LCD stuff before, but never a touch screen.

I am trying to update a system to use a new capacitive touch screen LCD for which the touch interface was previously SPI and is now I2C.

I should stress, I am successfully driving the screen via the RGB parallel interface - that bit has not changed. I have got the I2C interface up and running and when the screen is pressed I am getting the interrupt from the screen, able to read X1 and Y1 registers quite happily and I can see the values changing as I press different parts of the screen.

The datasheet [for this MI0430H1T-9] says it is 480 x 272 and when I read this touch data back I am getting minimum readings of about 33,9 and maximum of 464, 235. I assume the bezel is preventing me touching the very edges of the screen.

Now, the first issue is that I would expect the X to be reading from 0-480 and the Y from 0 to 272. However, X and Y seem to be the opposite way round to what I would expect.

I am reading registers 3 through to 6 inclusive. Datasheet says 3 and 4 are X position (12 bits plus event flags) and 5 and 6 contain Y position.

What I seem to get though is X data in registers 5 and 6. So, when I touch bottom left of the screen (the long side of the screen and therefore 480 pixels in length), registers 5 and 6 are changing, whereas registers 3 and 4 stay with approximately the same values as I move along the length of the screen.

On top of this, the bottom of the screen gives larger touch values and the top of the screen smaller touch values.

To summarise: bottom left of the screen I would expect to be 0,0, but gives me a touch reading of 259,33, top right gives me 39,458.

So, am I misunderstanding how these things work? The image from the datasheet below: Is that saying that, actually, Y touch data is 1-480?

Datasheet snippet

\$\endgroup\$
  • 2
    \$\begingroup\$ The touchscreen is normally just an overlay panel on top of the LCD, you can essentially consider it to be an entirely separate component that has its own resolution independent of the LCD. \$\endgroup\$ – Finbarr Jun 30 '17 at 12:19
  • \$\begingroup\$ Yes, I'm well aware of that. It doesn't answer any of my questions though. \$\endgroup\$ – DiBosco Jun 30 '17 at 12:32
  • \$\begingroup\$ Actually, let me rephrase that. I realised it was just an overlay; I wasn't sure how the resolution of it worked, although my findings seem to indicate, in this case, they match, but don't line up as I imagined. It doesn't answer most of my points. \$\endgroup\$ – DiBosco Jun 30 '17 at 12:41
  • \$\begingroup\$ The fact that they appear to have drawn the panel rotated by 90 degrees in the block diagram is probably not helping, and the datasheet seems confused. I would say it had 480 pixels in the X direction and 272 in the Y direction based on the "viewing direction" shown in the diagram on page 5. \$\endgroup\$ – Finbarr Jun 30 '17 at 13:10
  • 2
    \$\begingroup\$ This is why touch screens often have calibration routines - to map raw touch positions to display coordinates. And since they're completely independent from the display there's no intrinsic requirement that the touch X-Y orientation matches the display X-Y orientation. \$\endgroup\$ – brhans Jun 30 '17 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.