The response time of your system is going to be determined by the equation:
The mTouch ISR Interrupt Rate is determined by the equation:
mTouch ISR Interrupt Rate = (Fosc / 4) * Timer0 Prescaler * 224
where 224 is the average number of counts the TMR0 register must count through before tripping its flag. This value is not 256 due to the 'jittering' feature which varies the individual sampling times by preloading a value into the timer register.
Suggestions for Making the Response Time Faster:
- 1. Decrease CVD_SAMPLES_PER_SCAN to reduce the amount of oversampling.
This configuration option should never drop below 10 in normal applications. The higher this value is, the more stable the sensor's readings will be coming out of the acquisition ISR. However - the diminishing returns on this value follow an exponential curve. In other words, the increase in signal fidelity when changing from 10 to 20 samples is about the same as changing from 40 to 80.
- 2. Reduce the TMR0 Prescaler value.
This will increase the rate at which the timer's counter will increment. Do not set this value to 1:1 or the interrupt will occur too quickly to allow processing in the main loop. This value is determined by the application when it initializes the OPTION register. The framework does not adjust this register.
- 3. Increase the PIC's oscillator frequency.
This will increase the rate at which the timer's counter will increment, but will also increase the amount of power needed by the PIC.
- 4. Decrease CVD_NUMBER_SENSORS.
The mTouch Framework scans all sensors completely before returning the result to be processed by the main loop application. Reducing the number of sensors being scanned will reduce the number of times the ISR must be called before new data is available.
- 5. Reduce the amount of debouncing required to change sensor states.
There are two debounce values available:
DEBOUNCE_COUNT_PRESS is for the RELEASE-to-PRESS transition.
DEBOUNCE_COUNT_RELEASE is for the PRESS-to-RELEASE transition.