Datasheet
Motor Control Starter Kit User’s Guide
DS75015A-page 16 © 2011 Microchip Technology Inc.
The numerical value for each channel is filtered to remove noise, and then, based on
predefined thresholds, the position of the user’s finger on the slider is determined.
Movements over the slider can also be detected by monitoring both channels over a
period of time.
2.3 INTEGRATING MOTOR CONTROL AND mTouch
The dsPIC33FJ16MC102 DSC runs at a maximum of 16 MHz, and has sufficient
resources to run the Motor Control Starter Kit demonstration application, including the
motor control and the mTouch features.
Capacitive touch applications require a noise free environment, which is not the case
of motor control applications where MOSFETs turn on and off continuously, generating
noise spikes on the power supply levels. In such an environment, it is important to take
the capacitive slider measurements at a time when no MOSFETs are switching. This is
achieved by reducing the capacitance charging time to a minimum, by increasing the
charging current, and synchronizing it to the PWM cycle.
The ADC module of the dsPIC33FJ16MC102 DSC allows simultaneous sampling of
four different analog channels. Because three channels are needed for the BEMF feed-
back from the motor’s phases, one channel remains available for the CTMU module.
Both of the slider’s channels are sampled and converted alternatively on subsequent
PWM cycles, as shown in Figure 2-1.
FIGURE 2-1: CTMU AND PWM INTEGRATION TIMING
The CTMU module uses a trigger to start and stop charging of the slider’s capacitors.
The trigger is configured in such a way that the ADC starts conversion a few nanosec-
onds after the capacitor has stopped charging. This ensures that no PWM switching
occurs while sampling the voltage on the capacitor.
However, avoiding the PWM switching events in the charging period is also important.
This is easily achieved in this configuration since the duty cycle is usually much larger
than the capacitor charging time. After the ADC completes converting all four channels,
three BEMF signals and one of the capacitors, the ADC interrupt is triggered and the
capacitor is discharged to allow charging another one in the next cycle.
PWM Cycle
PWMxH
Charging
Trigger
Capacitor
ADC Start
Conversion
ADC Start
Conversion
ADC Start
Conversion
Start Charging
Channel A
Stop
Start Charging
Channel B
Stop
Start Charging
Channel A
Stop
Discharge Discharge Discharge
Voltage
Charging Charging
Charging