Generate a Generic Touch Sensing Project with MCC Melody

Last modified by Microchip on 2023/11/09 08:55

Objective

This article demonstrates how to create a generic project and add touch elements like buttons, sliders, and touch surfaces. It also demonstrates the windows for adjusting the settings of the sensors once they have been added to the project.

Reference Materials


Procedure

Create New Project

Create a new project by clicking the Folder button or from the File menu select New Project.

MPLAB X top menu bar to illustrate File or Folder method of creating a new project

Select Standalone Project and click Next in the New Project dialog box:

New Project Wizard first screen with Standalone Project selected

Select the required Device and click Next.

New Project Wizard second screen where you select your device

Select the suitable compiler and click Next.

New Project Wizard third screen where you select the compiler

Assign a project name and click Finish.

New Project Wizard final screen where you enter a name and location to store your project

Back to top


Open and Initialize MPLAB Code Configurator (MCC)
Open MCC by clicking on the MCC button.

MPLAB X toolbar showing the MCC button to open the tool

After initialization, click on the Select MCC Melody button.

Screenshot of Content Manager Wizard that pops up when MCC is started to choose between MCC Classic, Melody, or Harmony

Then, click Finish and wait for MCC to initialize and load the required contents.

Screenshot of Content Manager Wizard with Finish button

Back to top


Load Touch Configurator
Open the Content Manager in the Device Resources tab.

Screenshot of Device Resources window with Content Manager selected

Select the required version of the Touch Library from the dropdown.

Selecting the Touch Library from the Content Manager

Under Device Resources, expand the touch configurator from the Libraries menu and click on the Add button to add the Touch library.

Device Resources Tab now shows Touch Library, click the Add button

The touch configurator will be loaded on the right side of the IDE. A user tour will be initialized to guide the user about the available options inside the touch library.

User Tour of Touch Configurator that comes up on first initiation of the Touch Library

Back to top


Add Components and Apply Modifications
Click on the button, slider, wheel, and/or surface to add it to the configuration.

Screenshot of the Touch Configurator while adding a Button

Screenshot of the Touch Configurator

After the addition of the button/slider/wheel/surface, click on the Configure menu to apply different modifications.

The configure page - surface view in the Touch GUI

The configure page - pins view in the Touch GUI

Click on the displayed pin to select and assign an alternate set of pins to the selected button/slider/wheel.

Selecting a pin for the Button Sensor from the pull-down menu

Selecting sensor pins for a touch surface

Back to top


Modify Selections
Click on the Sensor Parameters to modify the selected button/slider/wheel’s Gain, Delay, Clock, etc.

Configuring the button/slider/wheel’s Gain, Delay, Clock etc. in the Sensor Parameter window

Click on the Common Parameters to modify the selected button/slider/wheel’s Drift Rate, Hold Time, etc.

Configuring the button/slider/wheel’s Drift Rate, Hold Time etc. in the Common Parameters window

Click on the Driven Shield to enable the Driven Shield Feature and add a dedicated shield pin.

The Driven Shield Page

Click on the Boost Mode to enable the Boost mode.

The Boost Mode page

Click on the Frequency Hop to enable Frequency Hop and Frequency Hop tuning.

The Frequency Hop page

Click on the Tune Tab to enable the Tuning Data connection.

Enabling Tuning Data collection on the 'Tune' tab

Back to top


Verify the Device's Summary
Click on the Summary tab to check the device's summary.

Click on the Summary tab to see all the settings for the device

Follow all the hints displayed in the Important Notes dialog box in the Create Tab section of the Touch Configurator.

Important Notes dialog box in the Create Tab section of the Touch Configurator

Back to top


Generate Code
Click on the Generate button in the Project Resources tab to generate the configured code.

Click the 'Generate' button to generate MCC project files

Files being generated by MCC

Back to top


Build Project
Click on the Build button to build the project.

Output window for a successful Build

Back to top


Additional Information

Surface Configuration

Orientation Shift

To change the orientation of the surface to match the orientation of the board clicks, any one of the coordinates is in the corner of the surface pin’s view.

Clicking on corner coordinates to get Orientation Selector pop-up

A popup with the option to switch orientation will be displayed. Select the required option to shift the coordinates and the pins to match the surface orientation of the connected board.

The Orientation Selector pop-up

Back to top

Timer Selection for PIC devices:

To import the required timer, change the scan rate from Free Running to Scan Rate in (ms).

Changing the Scan Rate configuration on the Common Parameters page

After changing the value to Scan Rate in (ms), the dependency selector will be displayed.

With 'Scan Rate in (ms)' selected, the Timing Dependency Selector is shown on the Common Parameters page

Back to Top

Results

Once you have finished configuring your project and are ready to export, you can export from MPLAB Xpress to MPLAB X IDE to start writing your application code or you can click on the Make and Program Device Main Project button to build and program the project to the kit.

Back to top