Objective
This guide shows you how to use the MPLAB® Code Configurator (MCC) mTouch® Sensing Solutions module to create a touch surface project and view the data in the 2D touch surface utility. The set-up requires the PIC18F57Q43 Curiosity Nano Board, Curiosity Nano Touch Adapter, QT8 Xplained Pro Extension Kit, and a connecting cable.
Materials
Hardware Tools
Software Tools
Tool | About | Installers |
Installation
Instructions |
||
---|---|---|---|---|---|
Windows | Linux | Mac OSX | |||
MPLAB® X
Integrated Development Environment |
| | | | |
MPLAB® Code Configurator
Dynamic Code Generation |
| | |||
MPLAB® XC8
C Compiler |
| | | | |
Procedure
1
Create an MPLAB X IDE Project for the PIC18F57Q43
- Choose Project: Standalone Project
- Select Device: PIC18F57Q43
- Select Tool: PIC18F57Q43 Curiosity Nano
- Select Compiler: XC8
- Select Project Name and Folder
If you are not familiar with MPLAB X IDE, please visit the Developer Help page.
2
Open MCC in MPLAB X IDE
If you do not see the MCC logo, please check that you have installed the MCC plugin. More information on MCC installation can be found on the step-by-step MCC installation page.
3
Configure the System Clock
Open the System Module from the Project Resources menu. Select HFINTOSC from the Oscillator Select drop-down box and select 32_MHz from the HF Internal Clock drop-down box. Choose a division factor of 1 from the Clock Divider drop-down box. This will result in a 32 MHz system clock.
To ensure the performance of the mTouch surface, the system clock is required to be at least 8 MHz. If you select a system clock slower than 8 MHz, the mTouch module will generate a warning in the notification window.
5
Select the mTouch Sensors
After loading the mTouch module, all available mTouch sensor pins will be shown in the Pin Manager: Grid View pane. You will need to select the physical sensors based on the sensor pinout information. Choose the sensors in the following order:
- RB0
- RA2
- RA6
- RC4
- RA7
- RC5
- RD4
- RA0
- RB3
- RC6
7
Enable Debugging with 2D Surface Utility and Configure Universal Asynchronous Receiver Transmitter (UART) Module
Go to the Debug tab within the mTouch module. Check the Enable Debug box, select UART1 to be the UART module, and select 2D Surface Utility as the debug method. The UART module will be automatically added to the project and should appear in the Project Resources window.
Click on the UART1 module in the Project Resources window to check that it is configured correctly.
Check that the RX and TX pins are properly selected in the Pin Manager: Grid View. The RX pin should be RB1 and the TX pin should be RB0.
10
Call mTouch Service and Enable Interrupts in main.c
Open the generated main.c file. Place MTOUCH_Service_Mainloop() into the while loop as shown in the code block, uncomment the functions that enable interrupts.
Add the files corresponding to the LED driver (led_driver.c, led_driver.h) to the project and call the LED functions correspondingly.
The contents of main.c, led_driver.c, led_driver.h files are shown below.
main.c
led_driver.c:
led_driver.h:
Table of Contents
|