How to Create a dsPIC33A Touch Application in MPLAB® Code Configurator (MCC) Melody

Last modified by Microchip on 2026/02/24 13:16

Overview

The following procedure shows how to create a Touch project with MPLAB® Code Configurator (MCC) Melody platform where the touch sensors and their parameters can be graphically added and tuned. The project supports the  MPLAB XC-DSC C compiler in  MPLAB X Integrated Development Environment (IDE). 

Materials

Hardware Tools

ToolAboutPurchase

dsPIC33A Curiosity Platform Development Board

dsPIC33A Curiosity Platform Development BoardEV74H48A | Microchip Technology
dsPIC33AK512MPS512 Curiosity GP DIM BoarddsPIC33AK512MPS512 Curiosity GP DIM BoardEV80L65A | Microchip Technology

Software Tools

  • MPLAB  X IDE with MCC plug-in installed

Hardware Connections

Connect the dsPIC33AK512MPS512 Curiosity GP DIM Board to the J1 connector of the dsPIC33A Curiosity Platform Development Board as shown in the accompanying image.

Hardware Connection

Prcedure

The following steps outline the procedure for creating a 3-button touch application. The touch application uses the onboard sensors available on the Curiosity Platform Development Board.

Open MPLAB X IDE and select File> New Project.

File menu


In the New Project window under Categories, select Microchip Embedded. From Projects, select Application Project(s) and click the Next button.

New Project window

In the Select Device pane, select the required device (here it is dsPIC33AK512MPS512) and click the Next button.

New Project window


Select the compiler under Compiler Toolchains and click the Next button.

New Project window

Provide a Project Name and a Project location. Then click the Finish button.

New Project window


Open MCC from Window >  MPLAB® Code Configurator > MPLAB® Code Configurator Open/Close.

Window menu

Under the Device Resource tab, add Touch from the Touch Configurator listed under Libraries

Device Resource tab


The Touch library will be included in the project, and the Touch configurations will be available in the MCC window. Before configuring the Touch parameters, please see the important notes related to the clock setup.

Important Notes

Add the timer for touch from the Dependency Selector. Configure the scan rate periodicity as shown in the accompanying image.

Application Builder

Enable Clock Generator 6 in the system clock settings and select the Clock Source as any one of the phase-locked loops.

Application Builder

Configure the PLLx VCO Divider Frequency or the PLLx Out Frequency between 32-320 MHz.

Application Builder

Confirm that the clock configured in the previous step has been updated in Clock Source Frequency and Calculated Clock Generated Frequency correctly.

Information

Note: The Clock Source Frequency of Clock Generator 6 should be greater than or equal to 32 MHz.

Application Builder


Configure Touch.

Create the required number of buttons/scrollers/wheels. 

Create tab

Configure the Sensor Pins.

Configure tab

Configure the Sensor Parameters.

Configure tab

Configure the Common Parameters.

Configure tab

Configure Frequency Hop/AFA.

Configure tab

Configure Driven Shield as required.

Configure tab

Under the Tune, select Touch Visualization (unidirectional, requires UART Tx).

Tune tab

Once all the required Touch parameters are configured, verify that the same is in the Summary tab of Touch configurator. 

Summary tab

Configuring TouchUART.

Select the required Universal Asynchronous Receiver/Transmitter (UART) in the dependency selector. Configure the Baud rate as 115200.

TouchUART configuration

Enable the required UART Tx pins in the Pin Grid view.

Pin Grid View


Click the Generate button. The User Output window shows "Generation Complete" after successfully generating the project.

Generate button

User Output window


In main.c, call touch_process() inside while(1) as shown in the accompanying image.

edit main

Back to Top