How to Create a Surface Touch Application in MPLAB® Code Configurator (MCC) Melody
Objective
The following procedure shows how to create a Touch Surface project with the MPLAB®Code Configurator (MCC) Melody platform, where the touch sensors and their parameters can be graphically added and tuned. The project supports the MPLAB XC8 compiler in MPLAB X IDE.
Materials
Hardware Tools
| Tool | About | Purchase |
|---|---|---|
AVR128DA48 CURIOSITY NANO | AVRDA Curiosity Nano Evaluation Kit | DM164151 | Microchip Technology |
| Curiosity Nano Touch Adaptor | Curiosity Nano Touch Adapter | AC80T88A | Microchip Technology |
| QT8 XPRO | QT8 XPLAINED PRO EXTENSION KIT | AC164161 | QT8 Xplained Pro Extension Kit |
Software Tools
- MPLAB X IDE with MCC plugin installed
Hardware Connections
Connect the AVR128DA48 Cnano Evaluation Kit to the Curiosity Nano Touch Adapter.
Connect the QT8 Xplained Pro Extension Kit to EXT1 header of the Curiosity Nano Touch Adapter as shown in the image below.

Procedure
The following steps describe the procedure to create a 5*5 Surface Touch Application. The touch application uses the QT8 Xplained Pro extension kit as the surface sensor.
Open MPLAB X IDE by going to File > New Project.
In the New Project pop-up window, select Categories > Microchip Embedded and Projects > Application Project(s). Click Next.
In the next window, select the required device, which is Device: AVR128DA48. Then click Next.
Select the Compiler Toolchains and click Next.
Provide a Project Name and a Project location. Click Finish.
Open MCC from Window > MPLAB Code Configurator > MPLAB Code Configurator Open/Close. Under the Device Resource tab, add Touch from the Touch Configurator listed under Libraries.
The Touch library will be included in the project, and the Touch configurations will be available in the MCC window. Take note of these Important Notes related to clock setup before configuring the Touch parameters.
Enable the Global Interrupt Enable in the Interrupt Manager.
Add RTC from Device Resources.
Enable Overflow Interrupt Enable in RTC configurator.
Under the Touch configurator tab, click Create, and select the surface. Configure a 5*5 surface sensor.
Configure the sensor pins under the Configure tab.
Configure the Sensor Parameters.
Configure the Common Parameters.
Configure the Gesture Parameters.
Configure the Frequency Hop/AFA.
Configure Driven Shield if required.
Under the Tune tab, enable the Touch Tuning Data connection if required. Select the required Tuning mechanism.
Once all required Touch parameters are configured, verify them in the Summary tab of Touch configurator.
Configure Touch Universal Asynchronous Receiver Transmitter (UART).
Select the required Universal Synchronous Asynchronous Receiver Transmitter (USART) in the dependency selector. Configure the desired USART Baud rate.
Enable the required UART Tx/Rx pins in the Pin Grid view. Ensure the USART Tx and Rx are enabled in the USART configurator.
Click the Generate button. The User Output window shows a "generation complete" message after successfully generating the project.
In main.c, call touch_process() inside while(1) as shown.