Custom Hardware Quick Start Guide

Note:
This guide assumes you are using custom hardware. For details on where to begin when implementing the mTouch framework on the mTouch CVD Evaluation Kit, use this guide.

Create a new MPLAB Project

First, create a new MPLAB 8 or MPLAB X project for your new application.

System Configuration

The mTouch_Init() function will automatically configure the ADC, communications module (if enabled), and all required interrupts. There are only a few things the user is required to define on power-up:

  1. Configure the oscillator to provide a fast clock speed.
     OSCCON = 0b01110000;       // 32 MHz Fosc w/ PLLEN_ON config word on PIC16F1937
    

  2. Set the prescaler for the timer you are using for the mTouch scan interrupt. (Weak pull-up resistors should be disabled.)
    For more information about the implications of this setting, see Processing Requirements.
     OPTION_REG = 0b10000000;   // TMR0 Prescaler = 1:2 (~40% processor usage)
    

  3. Sensor pins should be initialized as digital output low.
     ANSELA = 0b00000000;       // Digital
     TRISA  = 0b00000000;       // Output
     PORTA  = 0b00000000;       // Low   
    


Framework Configuration and Application API Hooks

See the basic sensor configuration guide and the feature-specific help section.