How to measure accurate value for resistive touch with ADC

Post Reply
Posts: 8
Joined: 18 Feb 2019, 14:02

01 Apr 2019, 14:55

The NuMaker emWin M487(NK-BEDM487D) is using resistive touch to implement HMI.

First user need to consider how to get the accurate value of ADC. Please follow below steps:
1. Make certain Vref of chip is right
2. Please refer to M480 TRM and set EXTSMPT to get enough sampling time. It does not impact the conversion performance when with enough sampling time.
ADC for resistive touch
2019-04-01_144349.png (5.19 KiB) Viewed 1132 times
How to get the position of the X axis?
One side(XL) is set to low, and another one(XR) need to set to high. YD should be set to floating, then we can get value of the X axis.
How to get the position of the Y axis?
Just like how to get X axis.

Posts: 8
Joined: 18 Feb 2019, 14:02

08 Apr 2019, 13:55

Where do we get the sample code of ADC touch?
1. Please download M480 BSP first as below website
2. unzip the file and open it, we can see a folder of NuMaker-PFM-M487D from sample code folder.
You should see two projects, one is "emWin_GUIDemo", the other one is "emWin_SimpleDemo". Both of two projects you should find the c file, M48XTouchPanel.c that included ADC touch initialization, ADC handler, x-axis, y-axis functions.

Posts: 8
Joined: 18 Feb 2019, 14:02

29 Apr 2019, 18:11

How to link the touch driver to GUI?
If you open the emWin_GUIDemo or emWin_SimpleDemo project, you should see the LCDConf.c file. emWin could call GUI_TOUCH_X_MeasureX() and GUI_TOUCH_X_MeasureY() functions regularly for getting X-axis and Y-axis.
The ADC function will be triggered by GUI_TOUCH_X_MeasureX() and GUI_TOUCH_X_MeasureY().

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests