Node Parameters

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

DO_NOT_REMOVE

In Microchip’s touch libraries, a node refers to a physical touch sensor element—such as a button, slider segment, or wheel segment—connected to a specific microcontroller channel. Node parameters are essential for configuring the acquisition and signal processing characteristics of each sensor element.

This section covers parameters that control an individual sensor's acquisition configuration. The node parameters for each channel are defined using the following macro definitions.

DEF_NUM_CHANNELS

#define DEF_NUM_CHANNELS (value)

Description: This macro defines the number of channels configured by the application. 

Range: 1 to 65535

More Info: The scroller/wheel sensor may have more than one channel. This parameter should be configured considering each channel in the scroller/wheel.

Example: NODE_0_PARAMS → Corresponds to Channel 0. 

NODE_x_PARAMS

#define NODE_x_PARAMS {X-line, Y-line, Charge Share Delay (CSD), NODE_RSEL_PRSC(series resistor, prescaler), NODE_GAIN(Analog Gain , Digital Gain), filter level}

Description: This macro defines node parameter settings.

Range: The ranges/values for each setting are as follows:

ParameterRange/Value*
X-line0 to Max_#_X-Lines*
Y-line0 to Max_#_Y-Lines*
CSD0 to 255
RSEL SelectionRSEL_VAL_0/ RSEL_VAL_20/ RSEL_VAL_50/ RSEL_VAL_70/ RSEL_VAL_100/ RSEL_VAL_200
PRESCALER SelectionPRSC_DIV_SEL_2/ PRSC_DIV_SEL_4/ PRSC_DIV_SEL_8/ PRSC_DIV_SEL_16/ PRSC_DIV_SEL_32/ PRSC_DIV_SEL64/ PRSC_DIV_SEL_128/ PRSC_DIV_SEL_256/
NODE_GAIN (common for both Analog and Digital)GAIN_1/ GAIN_2/ GAIN_4/ GAIN_8/ GAIN_16/ GAIN_32
FILTER_LEVELFILTER_LEVEL_1/ FILTER_LEVEL_2/ FILTER_LEVEL_4/ FILTER_LEVEL_8/ FILTER_LEVEL_16/ FILTER_LEVEL_32/ FILTER_LEVEL_64

Note: *The range of options can vary between devices. Refer to the api.h file for the list of allowed values. This range is handled when the project is generated using Microchip's MPLAB® Code Configurator (MCC).

More Info:

The Node (channel) parameters comprise the following configuration for each node.

  1. X-Line: The bit mask of the required X-line for this channel is configured here. There could be more than one bit set to high, indicating that this node is a LUMP node. In self-capacitance measurement, this field is configured as X_NONE (0). In self-capacitance with driven shield measurement, this field defines the mask of Y-lines that need to be driven as a shield for this node.
  2. Y-Line: The bit mask of the required Y-line for this channel is configured here. There could be more than one bit set to high, indicating that this node is a LUMP node.
  3. Charge Share Delay (CSD): Peripheral Touch Controller (PTC) measurement is divided into different phases, and the number of phases varies based on the technology and device. For each increase in CSD, one clock cycle of delay is added in each phase of PTC measurement. CSD can be used to properly charge and discharge the sensor. This option may not be available for all devices.
  4. NODE_RSEL_PRSC: The four LSB bits indicate the clock prescaler, and the four MSB bits indicate the Internal Y line series resistor selection. 
    Sensor TypeFormat
    Self-capacitancePRSC_DIV_SEL_x. The internal resistor should not be used in self-capacitance.
    Mutual capacitanceNODE_RSEL_PRSC(RSEL_VAL_x, PRSC_DIV_SEL_x).
    • RSEL: This is applicable only for mutual capacitance and should not be used on self-capacitance. Increasing this value reduces the amount of noise entering the PTC through the sense lines, thus improving noise performance. In mutual capacitance, this RSEL adds the resistance only on the Y line.
    • Prescaler: The prescaler is used to scale down the input clock to allow PTC operating frequencies. Increasing the prescaler reduces the clock frequency, thus increasing the time constant. The charge time can be adjusted by the clock prescaler for devices where the CSD feature is not available. If CSD is available, we recommend configuring the prescaler to a minimum value (max clock frequency) and using CSD to ensure proper charging time.
  5. Node Gain: The four LSB bits indicate the Digital Gain setting, and the four MSB bits indicate the Analog Gain setting. The gain is represented as NODE_GAIN (Analog Gain, Digital Gain).
    • Digital Gain: The accumulated result from an oversampled measurement is scaled down based on digital gain. The minimum recommended ratio of oversampling/digital gain is eight. For example, if the digital gain is configured as four, then the minimum required oversampling is 32.
    • Analog Gain: PTC's integrator is adjusted to control analog gain. Increasing the analog gain reduces the amount of noise that can be integrated. Increasing the analog gain from one to two reduces the integrator capacity by half, which makes the system more susceptible to noise. Therefore, we recommend using analog gain in noise-free systems. A higher gain setting increases touch delta as well as noise. So, the optimum gain setting should be used. Gain should be tuned such that the touch delta is between 40 and 60 counts.
  6. Filter Level: This defines the number of samples taken for each measurement. A higher filter level means more samples for each measurement, which averages the noise. Higher filter level settings take longer to do a touch measurement, which affects response time. Therefore, we recommend starting with the default value and increasing it depending on noise levels.

Back to Top