issue. You can use the extra I/O on the
20-pin part for functions you will only
use occasionally. All of these parts offer
the internal oscillator plus the internal
MCLR option, so all you really need to
hook up is Vdd ( 2.0-5.5V) and Vss
(ground) to bring the PIC MCU to life.
■ FIGURE 2. An example setup for the
Enhanced Capture and Compare PWM.
EXTRA FEATURES
Some of you may be reading this
and saying, “Duh, where have you been?
We’ve known about these parts.” Sorry
if I’m telling you something you already
knew, but I was surprised to find how
many advanced features these parts
have. One of them is the Enhanced
Capture and Compare PWM (ECCP)
peripheral that is great for designing a
motor-control application. Figure 2
shows a sample setup direct from the
data sheet. My layout in Figure 1 doesn’t
show the P1A through P1D pins, but you
can easily find them on the data sheet.
I hope to cover more on this
peripheral in the future article, as I
know motor control interests a lot of
people. The nice thing about this
peripheral is it handles all the timing
and even the dead-time delay required,
so you don’t ever have two FETs on at
the same time causing a short. This can
happen when one FET is shutting down
slowly while the other starts up quickly, causing the temporary short.
These parts also have internal comparators and even share some of the
same A/D connections, shown as all the
ANx pins in the layout of Figure 1. I really have to look at these parts for future
home projects, because they have some
of the latest and greatest PIC MCU features. They even have an LIN peripheral
in some of the parts, which is a communication bus that is growing in popularity within the automotive world. Again,
maybe you knew about all this but I just
wanted to show that even an old-timer
like me can work with PIC MCUs for
years and still discover new stuff.
PIC12HV615 and
PIC16HV616 —
which are newly
released. These are
Flash-based PIC
MCUs, but they
have a built-in shunt
regulator (which is
a fancy term for a
zener diode). This
means they can
run off of a higher
voltage without
needing an external
regulator. Figure 3 shows a schematic
for a PIC16HV616 with the shunt regulator series resistance and capacitance
in place. I’m not showing the MCLR
pull-up or the oscillator, since these
would be set to internal operation.
The key to using this part is setting
the proper series resistance and capacitance. There are three formulas for
calculating those values, depending
on the current and voltage range you
need to work with. I’ve found that you
either have a large voltage range or a
large current range, but not both at the
same time. For example, I chose to use
a voltage input of nine to 12 volts. This
limits how much current range I can
have. I limited my current variation to
20-25 ma. If I go above or below this,
the shunt regulator will be out of its
design limits. Most people can set
their design to a fixed voltage input,
which gives you a greater current
range to work with. The equations are
listed below as Equation 1, 2, and 6,
which I pulled from the Microchip
application note AN1035 and you can
download from www.microchip.com.
■ FIGURE 3. The
PIC16HV616 with built-in shunt regulator.
lower end of our voltage range and
the upper end of our current range,
we get the following:
Rmax = (9V – 5V)/1.05 (25ma + 4 ma)
Rmax = 131 ohms
Equation 2 gives us the lower limit
of the series resistance.
Rmin = (12V – 5V)/0.95 (20ma + 50 ma)
Rmin = 105 ohms
EQUATION 1:
With this, I select a value of 120
ohms that falls within the two limits.
But, I need to calculate the power rating of the resistor. Since the top of the
resistor can see a maximum of 12V and
the bottom will see the regulated 5V,
the power is found with the equation:
EQUATION 2:
Rpwr = (12V – 5V) 2 / 120 ohms
Rpwr = 0.4 Watts
HIGH-VOLTAGE (HV)
PIC MCUs
EQUATION 6:
Through this discovery phase, I also
was introduced to a couple of new
8/14-pin family members — the
Equation 1 gives us the upper
limit of the series resistance. Using the
Therefore, I’ll use a 1/2 W resistor.
Now I have to calculate the
capacitor. The data sheet states the
capacitor needs to be larger than
0.047 µF for noise suppression, and
less than the calculated capacitance
of Equation 6. So, putting the values in
the equation gives us the following:
May 2007 91