Acquisition Control Parameters

Last modified by Microchip on 2026/02/23 10:28

DO_NOT_REMOVE

Acquisition controls are critical parameters that define how and when capacitive touch measurements are performed in Microchip’s touch libraries. This section covers parameters that control the touch measurement (also known as acquisition) behaviors that are common for all the sensors.

DEF_TOUCH_MEASUREMENT_PERIOD_MS

#define DEF_TOUCH_MEASUREMENT_PERIOD_MS (value)

Description: This parameter defines the measurement period in milliseconds. The timer Interrupt Service Routine (ISR) will be set up according to this value. If the specified time is shorter than the measurement period, the touch measurement will occur consecutively without any breaks.

Range: 1 to 255

Default Value: 20

The following figure shows the measurement period and measurement time.

Measurement period and measurement time

DEF_SENSOR_TYPE

#define DEF_SENSOR_TYPE (value)

Description: This parameter defines the type of acquisition measurement used for touch sensors. This also depends on the sensor design and/or layout.

Values: 

  • For Self-capacitance: NODE_SELFCAP
  • For Mutual capacitance: NODE_MUTUAL
  • For Self-capacitance with Driven Shield: NODE_SELFCAP_SHIELD

More Info: A self-capacitance sensor requires one Y-line sense pin per button.

A mutual capacitance sensor requires one X-line drive pin and one Y-line sense pin per button. This configuration can realize an N x M matrix of sensors by using N X-line and M Y-line connections.

Self-capacitance with a driven shield is used when shielding the sensor is necessary, especially in environments with noisy circuits near the touch sensors. Adding a ground shield can have an impact on touch performance (sensitivity and water tolerance). The driven shield acts as an alternative to the ground shield without compromising the sensitivity and water tolerance. A driven shield can be enabled either on adjacent sensors only or additionally using a dedicated shield sensor. Having a dedicated shield sensor improves both noise performance and water tolerance. Configuring the adjacent sensor as a driven shield improves water tolerance on touch surfaces.

DEF_PTC_CAL_AUTO_TUNE

#define DEF_PTC_CAL_AUTO_TUNE (value)

Description: The calibration type selects which parameter should be automatically tuned for optimal charge transfer.

Range: (value) =  (uint8_t)((DEF_PTC_TAU_TARGET << CAL_CHRG_TIME_POS) | DEF_PTC_CAL_OPTION)

More Info: This parameter consists of two bit-fields: Bits 3:0 = DEF_PTC_CAL_OPTION and Bits 7:4 = DEF_PTC_TAU_TARGET. See the following two entries for their definitions.

Information

Note: In the #define statement, CAL_CHRG_TIME_POS is equal to 4u and is used to shift the DEF_PTC_TAU_TARGET bits into place.

DEF_PTC_CAL_OPTION

#define DEF_PTC_CAL_OPTION (value)

Description: This parameter determines whether the auto-tune charge time feature is enabled. When enabled, the auto-tune charge time feature helps adjust the parameters to ensure full charging of the sensor electrode.

OptionsDescription
CAL_AUTO_TUNE_NONEThis is the default value. The user-configured Charge Share Delay (CSD), prescaler, and Resistor Select (RSEL) are used by the touch library.
CAL_AUTO_TUNE_RSEL*Enabling this option will automatically select the maximum internal resistor that can be used - based on sensor capacitance and given charge time CSD/prescaler.
CAL_AUTO_TUNE_PRSC*Enabling this option will automatically adjust the prescaler and make sure that the sensor is fully charged.
CAL_AUTO_TUNE_CSD*Enabling this option will automatically adjust CSD and make sure that the sensor is fully charged.

Caution: * Auto-tune may not give accurate results under various conditions; therefore, the auto-tune option should not be used in production. In self-capacitance measurement, autotune doesn’t work correctly.

DEF_PTC_TAU_TARGET

#define DEF_PTC_TAU_TARGET (value)

Description: The calibration target applies a limit to the charge transfer loss allowed, where a higher setting of a target ensures a greater proportion of the full charge is transferred.

Note: PTC_TAU_TARGET is applicable only when CAL_AUTO_TUNE_NONE is not used. The time taken for a sensor to charge varies and depends on the values used here.

Bits 7:4 Calibration Target

ValuesDescription
CAL_CHRG_2TAUThis gives 2× the RC time constant for charging the sensor
CAL_CHRG_3TAUThis gives 3× the RC time constant for charging the sensor
CAL_CHRG_4TAUThis gives 4× the RC time constant for charging the sensor
CAL_CHRG_5TAUThis gives 5× the RC time constant for charging the sensor

DEF_PTC_INTERRUPT_PRIORITY

#define DEF_PTC_INTERRUPT_PRIORITY (value)

Description: This defines the interrupt priority for the Peripheral Touch Controller (PTC) Interrupt Service Routine (ISR). 

Range: 1 to 3 (for some devices, it is 1 to 7)

More Info: There will be a considerable number of interrupts when the number of sensors is greater. This could affect other high-priority interrupts used by the application; therefore, we recommend configuring the PTC interrupt as low-priority.

Note: Not applicable for all devices.

DEF_SEL_FREQ_INIT

#define DEF_SEL_FREQ_INIT (value)

Description: This defines the default PTC's acquisition frequency. If the Frequency Hop or Frequency Hop Autotune module is used, then the acquisition frequency will be dynamically updated by those modules.

Range: FREQ_SEL_0 to FREQ_SEL_15

Back to Top