The NuMaker emWin M487(NK-BEDM487D) is using resistive touch to implement HMI.
https://direct.nuvoton.com/tw/numaker-emwin-m487
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.
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.
How to measure accurate value for resistive touch with ADC
Where do we get the sample code of ADC touch?
1. Please download M480 BSP first as below website
https://github.com/OpenNuvoton/M480BSP
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.
1. Please download M480 BSP first as below website
https://github.com/OpenNuvoton/M480BSP
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.
How to link the touch driver to GUI?
Ans:
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().
Ans:
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().
-
- Information
-
Who is online
Users browsing this forum: No registered users and 26 guests