Creating a Driven Shield Project with MHC

Last modified by Microchip on 2023/11/10 11:18

Creating a Driven Shield Project with MPLAB Code Configurator (MCC)


Warning: This tutorial uses the old Harmony configuration tool (MPLAB® Harmony Configurator (MHC)). New Harmony projects should use the MPLAB Code Configurator (MCC) instead.

 

MPLAB® Harmony v3 is now configurable through MPLAB Code Configurator (MCC). Although the instructions in this tutorial are for MPLAB Harmony Configurator (MHC), the flow and experience of creating a project, configuring peripherals, and generating code using MCC are similar. Refer to the following links for specific instructions to use MPLAB Harmony v3 with MCC.

Objective

This page shows you how to create a Driven Shield Touch MPLAB® Harmony project from scratch.

Back to Top

Reference Materials


Back to Top


Procedure

Launch MHC

Open MHC by going to Tools > Embedded > MPLAB Harmony 3 Configurator.

Tools > Embedded > MPLAB Harmony 3 Configurator

Back to Top

Touch Library

Add the Touch Library, and when prompted, allow the Real Time Clock (RTC) Peripheral connection.

Touch Library prompt

Back to Top

Open the Touch Configurator

Open the Touch Configurator by going to MHC > Tools > Touch Configuration.

Touch Configurator: MHC > Tools > Touch Configuration.

Back to Top

Add Buttons, Sliders, and Wheels

Add buttons, sliders, and wheels as required and assign the Y lines to each.

Driven Shield and Driven Shield+ only function with self-capacitance sensing

Sensors Tab

Pin Selection Tab

Back to Top

Configure the Driven Shield

Refer to the "Guide for Timer-based Driven Shield on SAM Devices".

Simultaneous use of both Driven shield and Driven Shield+ is possible.
Refer to the “I/O Multiplexing and Considerations” section of the target device datasheet to examine the various touch pins that also support the TC or TCC outputs.

For the PIC32MZDA device, refer to Procedure To Enable Driven Shield.

Choosing the Driven Shield Option

  1. Select the Enable Dedicated Driven Shield checkbox
  2. Choose from the available TC/TCC to set the Timer Instance.
  3. Choose the Shield pin.
  4. Click Apply to update the Project Configuration. Allow the use of the TC/TCC as prompted.

Touch Configurator:  Enable Dedicated Driven Shield checkbox

Choosing the Driven Shield+ Option

  1. Select the Enable Driven Shield Plus checkbox
  2. Choose from the available TC /TCC to set the Timer Instance.
  3. Click Apply to update the Project Configuration. Allow the use of the TC/TCC as prompted.

In Step 2 above, not all pins support Timer Output in this QT7 example, see the “I/O Multiplexing and Considerations” section in the SAMD21 datasheet.

Touch Configurator: Enable Driven Shield Plus checkbox

When applied, the Project Graph should now contain the relevant timers for Driven Shield/Driven Shield+ in addition to the RTC.

In this example, Data Visualizer was also enabled.

Project Graph with the relevant timers

Back to Top

Generate Code

Generate the Example Code to create the source code by going to MHC > Generate Code.

MHC > Generate Code

Back to Top

Enable Touch

Enable touch in the main application by adding touch_process(); within the main loop.

touch_process(); function within the main loop.

Back to Top