Generate a Touch Project With MPLAB® Code Configurator (MCC) Harmony

Last modified by Microchip on 2026/02/23 14:23

Objective

This procedure outlines how to create a touch project using the MPLAB® Code Configurator (MCC) with the Harmony platform. In this project, you can graphically add and adjust touch sensors and their parameters. The resulting project supports the MPLAB XC32 Compiler in MPLAB X IDE. The following step-by-step guide details how to generate a mutual capacitance project using MCC Harmony. This project utilizes the SAML10 Xplained Pro board along with the T10 Mutual Capacitance Xplained Pro Extension Kit.

Materials

ToolAboutPurchase
ATSAML10 XPROProduct details pageDM320204 - SAM L10 Xplained Pro
T10 XPROProduct details pageAC47H23A - T10 Xplained Pro Extension Kit

Software Tools

  • MPLAB ® X IDE with MCC plugin installed

Procedure

 Open MPLAB X IDE

Click File > New Project in MPLAB X IDE.

File menu

Back to Top


Choose Project

In the New Project window, select Application Project(s) and click Next.

New Project window Choose Project pane

Back to Top


Device Selection

Choose the device for which the project needs to be generated and click Next.

New Project window Select Device dialog

Back to Top


Compiler Selection

Choose the latest compiler for 32-bit devices and click Next.
New Project window Select Compiler dialog

Back to Top


Project Settings

Enter the Location, Folder, and Path for the project and click Next.

New Project window Name and Location pane

Back to Top


MCC Harmony with Touch Packages

MPLAB Harmony is opened along with the Project Graph. 

Project Graph

Open the content manager and update touch under Harmony 3 - Capacitive Touch solutions and click Apply.

The latest touch repo will be downloaded and MPLAB Harmony is then ready to use for generating a touch project.  

MCC Content Manager

Back to Top


In the Device Resources pane, select Touch Library.

Device Resources pane

A pop-up window appears asking for PTC and RTC activation. Click Yes.

Components auto-activation dialog

Now, Touch Library, RTC, and PTC are added to the Project Graph.

Project Graph

Back to Top


Launch Touch Configurator by selecting it from the Plugins drop down.

Plugins dropdown

Back to Top


Choose Technology

The T10 Xplained Pro extension board consists of four mutual cap touch buttons and one slider sensor.

Choose Mutual Cap as the sensing technology from the drop-down in the Touch Configuration window, as shown.

Touch Configuration window

Back to Top


Add Buttons

Click Button icon and input 4 as the number of buttons.

Touch Configuration window

An Information pop-up indicating that the clock for CPU and peripherals is set appears. Click Ok.

Information pop-up

Back to Top


 Add Slider

Click the Slider icon and input 1 for Sliders and 4 for Segments (if not already present).

Touch Configuration window

Now, four buttons and a four-channel slider are added.

Touch Configuration window

Back to Top


Pin Assignment

A generalized pin assignment for a majority of the Xplained PROs, Curiosity PROs, and MCUs has been provided in the Curiosity Nano Touch Adapter Pin Configuration.

If the MCU or the XPRO board is not available, then you can assign the pins based on the data sheet or user guide for that particular MCU or XPRO.

Based on the configuration, the X and Y lines should be selected as follows.

SensorChannel IDX LineY Line
Button 0052
Button 1142
Button 2212
Button 3302
Slider 0453
543
613
703

Back to Top


The pin assignment can be done in Configure > Sensor Pins. With respect to the previous table, in touch configurator, the pins were selected. Once the pins are selected, click Create.

Configure tab

Information

Note: When configuring the pins, we can add or remove the X and Y lines as shown. 

Pin configuration

The pin assignment can be seen in Matrix view or Table view, as shown in the accompanying image. 

Matrix view

Table view

Back to Top


Sensor Parameters

For tuning the touch parameters, select Config > Sensor Parameters and tune according to the application.

All the parameters are tunable for buttons, sliders, and wheels.

The Sensor Parameters tab enables the configuration of touch sensor parameters, such as:

  • Digital Filter Gain
  • Digital Filter Oversampling
  • Analog Gain
  • Series Resistor
  • Addition Charge Share Delay
  • PTC Clock
  • Sensor Detect Threshold
  • Sensor Hysteresis
  • Sensor AKS

Configure tab

Back to Top


Common Parameters

For tuning the touch parameters, select Config > Common Parameters and tune according to the application.

The Common Parameters tab enables the configuration of touch sensor parameters, such as:

  • Acquisition
    • Scan Rate
    • PTC Interrupt Priority
    • Acquisition Frequency
  • Sensor
    • Detect Integration
    • Away from Touch Recal Integration Count
    • Away from Touch Recal Threshold
    • Touch Drift Rate
    • Away from Touch Drit Rate
    • Drift Hold Time
    • Re-burst mode
    • Max ON Duration

Configure tab

Back to Top


Frequency Hop

Frequency Hop can be enabled by navigating to Config > Frequency Hop and then sliding the Enable Frequency Hop button. A maximum of seven frequency steps can be selected, which can be individually configured using the drop-down. Hop Frequencies are fixed at the time of compilation in Frequency Hop. The auto-tune feature can be enabled by sliding the Enable Frequency Auto Tuning button. A detailed description of how to configure the Frequency Hop and Frequency Hop Autotune is provided in the How to Enable Frequency Hop Auto Tuning page.

Configure tab

Back to Top


Touch Tuning

Enable the data streamer by enabling the Enable Touch Tuning Data connection option. A detailed description of how to configure the data streamer is provided in the Tuning Options for Touch in MPLAB® Code Configurator (MCC) Melody and Harmony page.

Tune tab

Back to Top


Summary

Click on the Summary tab to review the project configuration and find versions of library modules.

Summary tab

Back to Top


Once the project is configured, click on Project Resources > Generate to generate the code.

Generate button

User Output button

Back to Top


Include touch_process() in the main while(1) loop. Now the project is ready for testing on the kit.

main while loop

Back to Top