mTouchCVD_Config.h File Reference

Main mTouch application configuration file. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

Required, Basic Configuration Options

These configuration options must be uniquely set for each application.

#define _XTAL_FREQ
 The Fosc frequency of your system in Hz.
#define TMR0_PRESCALER
 The TMR0 prescaler value of your system.
#define CVD_NUMBER_SENSORS
 Number of CVD Sensor Inputs.
#define CVD_SENSOR0
 Analog port assignment for Sensor 0.
#define CVD_SAMPLES_PER_SCAN
 Determines the degree of oversampling and the sample rate of your system.
#define CVD_DEBUG_SPEED
 Determines the output transfer speed of the communications module. Valid options: 9600 (preferred) or 115200.
#define CVD_Software_Revision
 Used to determine what communication protocol to use when sending data to the mTouch GUI. Leave set to 0002.
Predefined Option Macros to Provide Specific Sampling Rates

These macros are calculations that use the clock frequency, TMR0 prescaler, average jitter preload value, and the number of sensors to calculate the number of scans between decoding to ensure a specific timing. They are only used if they are chosen as the CVD_SAMPLES_PER_SCAN value.

#define CVD_100ms_Timing
 Precalculated CVD_SAMPLES_PER_SCAN value to achieve ~100ms sample rate.
#define CVD_20ms_Timing
 Precalculated CVD_SAMPLES_PER_SCAN value to achieve ~20ms sample rate.
#define CVD_17ms_Timing
 Precalculated CVD_SAMPLES_PER_SCAN value to achieve ~17ms sample rate.
Adjusting the Framework's Behavior

These configuration options will adjust the acquisition and decoding behavior of the mTouch Framework. Editting these values is optional.

#define THRESHOLD_PRESS_SENSOR0
 Determines the press threshold of sensor 0.
#define CVD_SCALING
 mTouch CVD post-scaler of reading value
#define CVD_DEBUG_OUTPUT_RAW
 When defined, the communications module will output raw data in its information packet.
#define POWER_UP_SAMPLES
 Number of total scans that should be taken across all sensors before they will be considered initialized.
#define BUTTON_TIMEOUT
 Number of press decisions before resetting sensor to released state.
#define AVG_UPDATE
 Determines the weight given to the raw value when updating the average.
#define AVG_RATE
 Sets the update rate of the average when unpressed.
#define RELEASE_THRESHOLD_FACTOR
 Defines the hysteresis relationship between the press and release thresholds.
#define CVD_JITTER_TYPE
 Selects between two acquisition jittering implementations.
#define DEBOUNCE_COUNT_RELEASE
 Number of consecutive scans a sensor must be decoded as released before changing states.
#define DEBOUNCE_COUNT_PRESS
 Number of consecutive scans a sensor must be decoded as pressed before changing states.
#define NEGATIVE_CAPACITANCE
 Determines the method used to handle a negative capacitance shift on the readings.
#define CVD_SETTLING_DELAY
 Determines the amount of time provided for the external sensor and internal hold capacitor to balance their voltages during the CVD scanning process.
#define CVD_CHOLD_CHARGE_DELAY
 Determines the amount of time provided for charging the internal hold capacitor of the ADC during the CVD scanning process.
Unimplemented

These options are still under development and are not yet implemented.

#define CVD_DEBUG_PIN
 Not currently implemented.
#define CVD_Frame_Revision
 Not currently implemented.
#define CVD_Board_Revision
 Not currently implemented.
Advanced Options - Not recommended except for debugging

These configuration options will adjust a fundamental section of the framework to perform differently. Care should be taken by anyone using these options as they will have a significant effect on the operation and noise performance of the system.

#define AVG_ENABLE
 Enables/Disables implementation of a baseline average. Turning this off is highly discouraged.
#define CVD_JITTER_ENABLE
 Enables/Disables implementation of the TMR0 jittering feature. Turning this off is highly discouraged due to noise immunity concerns.

Detailed Description

Main mTouch application configuration file.

Definition in file mTouchCVD_Config.h.


Define Documentation

#define CVD_100ms_Timing

Precalculated CVD_SAMPLES_PER_SCAN value to achieve ~100ms sample rate.

Using the generalized formula:

\[ SamplesPerScan = \frac{\frac{F_{OSC}}{4} * DesiredSampleRate}{(256 - 2^{N-1}) * TMR0_{Prescaler} * NumberOfSensors} \]

where

  • FOSC is the frequency of the PIC microcontroller's oscillator
  • 4 is the number of clock cycles required to execute one instruction
  • DesiredSampleRate is given in seconds
  • 256 is the number of bits in TMR0
  • N is the number of bits being used to jitter the TMR0 reload value
  • 2N-1 is the average offset added to TMR0 by the jittering process

Since N does not change, this has been simplified down to:

\[ SamplesPerScan = \frac{\frac{F_{OSC}}{4} * 0.100}{224 * TMR0_{Prescaler} * NumberOfSensors} \]

Definition at line 116 of file mTouchCVD_Config.h.

#define CVD_17ms_Timing

Precalculated CVD_SAMPLES_PER_SCAN value to achieve ~17ms sample rate.

Using the generalized formula:

\[ SamplesPerScan = \frac{\frac{F_{OSC}}{4} * DesiredSampleRate}{(256 - 2^{N-1}) * TMR0_{Prescaler} * NumberOfSensors} \]

where

  • FOSC is the frequency of the PIC microcontroller's oscillator
  • 4 is the number of clock cycles required to execute one instruction
  • DesiredSampleRate is given in seconds
  • 256 is the number of bits in TMR0
  • N is the number of bits being used to jitter the TMR0 reload value
  • 2N-1 is the average offset added to TMR0 by the jittering process

Since N does not change, this has been simplified down to:

\[ SamplesPerScan = \frac{\frac{F_{OSC}}{4} * 0.017}{224 * TMR0_{Prescaler} * NumberOfSensors} \]

Definition at line 118 of file mTouchCVD_Config.h.

#define CVD_20ms_Timing

Precalculated CVD_SAMPLES_PER_SCAN value to achieve ~20ms sample rate.

Using the generalized formula:

\[ SamplesPerScan = \frac{\frac{F_{OSC}}{4} * DesiredSampleRate}{(256 - 2^{N-1}) * TMR0_{Prescaler} * NumberOfSensors} \]

where

  • FOSC is the frequency of the PIC microcontroller's oscillator
  • 4 is the number of clock cycles required to execute one instruction
  • DesiredSampleRate is given in seconds
  • 256 is the number of bits in TMR0
  • N is the number of bits being used to jitter the TMR0 reload value
  • 2N-1 is the average offset added to TMR0 by the jittering process

Since N does not change, this has been simplified down to:

\[ SamplesPerScan = \frac{\frac{F_{OSC}}{4} * 0.020}{224 * TMR0_{Prescaler} * NumberOfSensors} \]

Definition at line 117 of file mTouchCVD_Config.h.