Datasheet
MOTOR CONTROL STARTER
KIT USER’S GUIDE
© 2011 Microchip Technology Inc. DS75015A-page 15
Chapter 2. Software Description
The starter kit tutorial application demonstrates how to successfully integrate a noise
sensitive mTouch application within a standard Motor Control environment.
This chapter contains the following topics:
• Motor Control Application
• mTouch Capacitive Slider Application
• Integrating Motor Control and mTouch
2.1 MOTOR CONTROL APPLICATION
The motor control software and hardware on this starter kit are based on the algorithm
described in the application note, AN1160 “Sensorless BLDC Control with Back-EMF
Filtering Using a Majority Function”, which is available from the Microchip website
(www.microchip.com).
The main difference from the standard AN1160 software is the way the overcurrent fault
functionality is implemented. The dsPIC33FJ16MC102 DSC features an internal ana-
log comparator, which allows instant detection of an overcurrent condition and imme-
diate hardware shutdown of the PWM outputs. The overcurrent level can be easily set
in software, thus making the solution much more flexible and adaptable to a wide range
of motors.
The motor current that passes through a shunt, is amplified by an operational amplifier
and is available as input on an analog pin of the dsPIC33FJ16MC102 DSC. The analog
input can be configured in software both as a comparator input and as an ADC input.
Reading the current with the ADC module offers the possibility of implementing more
complex control algorithms, such as the single shunt.
To close the Fault detection loop, the comparator output is wired externally to the PWM
Fault input. As soon as the current exceeds the level set in software, the comparator
will toggle its output and the PWM will be shut down immediately, without waiting for
the next clock pulse to occur.
2.2 mTouch CAPACITIVE SLIDER APPLICATION
The capacitive slider on the Motor Control Starter Kit is implemented based on the
application note, AN1250 “Microchip CTMU for Capacitive Touch Applications”. For
detailed information on mTouch sliders and buttons, and the CTMU module, refer to
this document, which is available from the Microchip website (www.microhip.com).
A two-channel capacitive slider is implemented on the Motor Control Starter Kit. Each
channel is connected to an analog input on the dsPIC33FJ16MC102 DSC. The CTMU
module charges each channel’s capacitance with a fixed current for a certain amount
of time. The capacitance of each channel depends on the position of the user’s finger
over the slider, and it is at its higher value when the slider is not touched. After the fixed
charging time has elapsed, the CTMU module stops charging the capacitors and trig-
gers the ADC to start sampling and converting the voltage on each capacitor to a
numerical value.