Generate a Generic Touch Sensing Project with MCC Melody
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.
Select Standalone Project and click Next in the New Project dialog box:
Select the required Device and click Next.
Select the suitable compiler and click Next.
Assign a project name and click Finish.
Open and Initialize MPLAB Code Configurator (MCC)
Open MCC by clicking on the MCC button.
After initialization, click on the Select MCC Melody button.
Then, click Finish and wait for MCC to initialize and load the required contents.
Load Touch Configurator
Open the Content Manager in the Device Resources tab.
Select the required version of the Touch Library from the dropdown.
Under Device Resources, expand the touch configurator from the Libraries menu and click on the Add button to add the Touch library.
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.
Add Components and Apply Modifications
Click on the button, slider, wheel, and/or surface to add it to the configuration.
After the addition of the button/slider/wheel/surface, click on the Configure menu to apply different modifications.
Click on the displayed pin to select and assign an alternate set of pins to the selected button/slider/wheel.
Modify Selections
Click on the Sensor Parameters to modify the selected button/slider/wheel’s Gain, Delay, Clock, etc.
Click on the Common Parameters to modify the selected button/slider/wheel’s Drift Rate, Hold Time, etc.
Click on the Driven Shield to enable the Driven Shield Feature and add a dedicated shield pin.
Click on the Boost Mode to enable the Boost mode.
Click on the Frequency Hop to enable Frequency Hop and Frequency Hop tuning.
Click on the Tune Tab to enable the Tuning Data connection.
Verify the Device's Summary
Click on the Summary tab to check the device's summary.
Follow all the hints displayed in the Important Notes dialog box in the Create Tab section of the Touch Configurator.
Generate Code
Click on the Generate button in the Project Resources tab to generate the configured code.
Build Project
Click on the Build button to build the project.
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.
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.
Timer Selection for PIC devices:
To import the required timer, change the scan rate from Free Running to Scan Rate in (ms).
After changing the value to Scan Rate in (ms), the dependency selector will be displayed.
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.