SLAAEU1A August   2025  – September 2026 MSPM0L1306

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1 Introduction
  5. 2 LaunchPad Setup
  6. 3 Hardware Connection
  7. 4 Design Considerations
    1. 4.1 IO Selection Consideration
    2. 4.2 Measurement Method
      1. 4.2.1 Touch Detection Method
      2. 4.2.2 X-Axis and Y-Axis Measurement
  8. 5 Software Structure
    1. 5.1 Touch Detection Example
    2. 5.2 Resistive Click and Drag Detection
    3. 5.3 Pin Mode Switching
  9. 6 Steps for Execution
  10. 7 Results
    1. 7.1 Touch Detection
    2. 7.2 Click and Drag Detection
  11. 8 Summary
  12. 9 References
  13. 10Revision History

X-Axis and Y-Axis Measurement

When a user applies pressure, the top layer contacts the bottom, creating a closed circuit at that location. By applying a voltage across one axis (for example Y-axis) and measuring the voltage drop across the perpendicular axis (X-axis), the microcontroller can determine the precise X and Y coordinates of the touch point.

The touch detection method is shown in Section 4.2.1. When there is a touch, the detection method establishes a complete circuit between the resistive layers. By applying a known voltage (3.3V), across one axis (Y-axis) and measuring the resulting voltage drop on the perpendicular axis (X-axis), the microcontroller calculates the precise touch location.

 X-axis ADC MeasurementFigure 4-2 X-axis ADC Measurement

For the X-axis detection, set PA17 to output high and PA15 to output low. Set other pins to be analog functions (Hiz mode). Then, enable the ADC channel at PA16 to do the measurement.

 Y-axis ADC Measurement Figure 4-3 Y-axis ADC Measurement

For the Y-axis detection, set PA16, PA24 and PA0 to output high and, PA25, PA22 and PA21 to output low. Set other pins to be analog functions (Hiz mode). Then, enable the ADC channel at PA15 to do the measurement.

After getting the voltage, the ADC does an oversampling to reduce the noise and directly use the ADC result as the coordinate and output to UART console.