- Application: This sample code based on NUC126 for implementing the 4-wired resistive touch panel controlled.
- BSP Version: NUC126 Series BSP CMSIS v3.00.003
- Hardware: NuTiny-NUC126
Currently, there are 4-wired, 5-wired, 7-wired and 8-wired types resistive touch panel on the market. This sample code based on 4-wired resistive ADC touch panel.
The X-axis direction of touch panel is regarded as resistor and the Y-axis direction of the touch panel is regarded as another resistor, too. When user press the touch screen, we can get two sampling result from X-axis and Y-axis resistor by ADC. After sampling finished, calculating the touch point by the ADC sampling result.
For example, the resolution of touch panel is 128x160. Because the NUC126 is equipped with 12 bits ADC, the 5V will be divided into 4096 parts. The ADC sampling result on the far left point, 0 point on X-axis will map to probably 500 but 0. The ADC sampling result on the far right point, 128 point on X-axis will map to probably 3200 but 4095, too. Hence, the result of ADC sampling should be normalized.
You can download the sample code at https://www.nuvoton.com/resource-downlo ... 1227115130
|