This is only a preview of the April 2022 issue of Silicon Chip. You can view 47 of the 120 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "500W Power Amplifier, Part 1":
Articles in this series:
Items relevant to "Railway Semaphore Signal":
Items relevant to "Update: SMD Test Tweezers":
Items relevant to "Capacitor Discharge Welder, Pt2":
Purchase a printed copy of this issue for $11.50. |
Working with the latest
8-bit PICs from
Microchip seem to be releasing a new series of PICs virtually every year. We’re
trying to keep up with them by using the latest devices in our designs, mainly
because each new series offers better value than the last. Here is what we’ve
found in switching to the latest series.
W
hile the current parts
shortage makes things difficult, we always relish the opportunity to work with new parts and learn
about their new features. In updating
the SMD Test Tweezers (article starts
on page 72), we’ve been using the
PIC16F15214 and we’re also anticipating some fresh new parts being
released later this year.
The crisis strikes back
With the electronics parts shortage
showing no signs of easing, we found
that the PIC12F1572 that we have used
in a number of our designs were no
longer available in the -I/SN variant,
which is the SOIC package version
[SN] specified for the industrial temperature range [I].
The -E/SN part (E = extended temperature range) variants are a drop-in
substitute, although they are slightly
more expensive. We got some of those
while they were available. But soon,
we couldn’t get either.
We then noticed that there are also
PIC12LF1572 variants, where the “LF”
infix signifies a part designed for operation at lower voltages (not all PICs
have LF variants).
As we were powering many of these
devices from 3V lithium coin cells,
these parts were also suitable, so we
grabbed some before they (quickly)
became unavailable.
The LF variants are suitable for
use with our SMD Tweezers and Tiny
LED Christmas Ornaments designs
(November 2020; siliconchip.com.au/
Article/14636), both running from the
previously mentioned coin cells. In
fact, the LF parts have slightly lower
current demands than the F parts, so
they are a better choice in designs that
don’t go over 3.6V, and are well suited
to battery operation.
Even so, we found ourselves
80
Silicon Chip
struggling to get parts that we needed
to supply kits for projects using the
PIC12F1572 microcontrollers and
their variants.
As well as the Ornaments and
SMD Tweezers, the Nano TV Pong
(August 2021; siliconchip.com.au/
Article/14988) and Digital FX Unit
(April & May 2021; siliconchip.com.
au/Series/361) also use this or similar chips.
As our stocks dwindled, we discovered that the newer PIC16F15213 was
available, so we adapted the Xmas
Ornament firmware to work on these
chips and started supplying them
with kits.
The PIC16F15213 is much the same
as the PIC16F15214 we’re using in
the Improved SMD Test Tweezers,
but with half the RAM and half the
flash program memory. Even then,
the simple program for the Ornaments only uses a small fraction of the
PIC16F15213’s resources.
The control firmware for the Nano
TV Pong was written mostly in assembly language to allow it to be fast
enough to generate a composite video
signal in real time.
Assembly language is more part-
specific than the C language we normally use, so it is not so easily transferred to a different microcontroller.
But by using the 16F15213s for the
Xmas Ornaments, we were able to keep
enough 12F1572s on hand.
Having been exposed to a new 8-pin
PIC series, whether we wanted to or
not, we decided to see what we could
do with it, and the Improved SMD Test
Tweezers was the logical outcome.
Return of the IDE
The PIC16F152xx family is quite
By Tim Blythman
Australia's electronics magazine
new, with the data sheet dated 2020.
So you will need a fairly new version
of the MPLAB X IDE to work with these
parts and you will also need to install
the correct DFP (device family pack),
as well as a compiler.
We’ve successfully used MPLAB
X versions 5.40 and 5.50 with these
parts. Note that these versions only
support 64-bit processors on your
computer, so you might have trouble
working with these parts if you have
an older computer.
We’re using XC8 compiler v2.20
for the updated version of the Tweezers. The older v2.00 appears greyed
out when the PIC16F15214 part
is selected, while the newer v2.32
appears to be compatible.
The device support list also indicates that the PICkit 3 can’t handle these parts either. We have been
using an MPLAB Snap programmer
and it appears that the PICkit 4 will
also work.
On that note, we should point out
that programming these parts is blindingly fast; fast enough that you aren’t
really sure the programmer has done
anything!
The PIC16F152xx family is
described as an enhanced mid-range
8-bit microcontroller. The ‘enhanced’
designation mostly describes the processor core and instruction set, which
have been designed to work with features of the C programming language.
The enhanced core has been around
a while, with parts like the PIC16F1455
(used in the Microbridge project from
the May 2017 issue – siliconchip.com.
au/Article/10648) having this feature.
Still, the PIC16F152xx family
appears to have a slightly newer generation of the enhanced core which
lacks the OPTION register and thus
also the OPTION opcode. Remarkably,
the TRIS opcode (which was long ago
siliconchip.com.au
Silicon Chip
Binders
REAL
VALUE A
T
$19.50*
PLUS
P&P
Like most microcontrollers from Microchip, the PIC16F15214 comes in multiple
different packages with only some of them shown above.
marked as deprecated) is still around.
The peripheral pin select (PPS) function allows certain digital peripherals
to be mapped to different digital pins.
It appears that for all PIC16F152xx
parts with twenty or fewer pins, just
about any digital peripheral (including PWM, timers, counters and serial
communication) can be mapped to
any digital pin.
There are a few other novel features
that we found while perusing the data
sheet. The flash memory can now be
partitioned with the MAP (memory
access partition) settings. This allows
certain parts of the flash memory to be
allocated to various purposes.
For example, regions can be marked
as boot block, application block and
storage area. If a storage area is marked,
code cannot be run from that area,
which is sensible if the area is used
to store data which should not be executed as code.
These devices lack an internal
EEPROM, so the storage area is typically used to provide an equivalent
place for non-volatile, infrequently
changed data to be stored. Unlike
EEPROM, it can only be erased a page
at a time.
The boot block and application
block can both be separately write protected. A typical implementation for
upgradeable firmware would provide
for a write protected boot block and a
writeable application block.
Code in the boot block could be
written to receive and modify firmware in the application block to
upgrade the firmware. These restrictions only apply to code running on
the actual chip and naturally, an external programmer is always able to make
changes or erase the device.
An internal high-frequency oscillator can provide a main system clock
from 1MHz up to 32MHz (in powers of
siliconchip.com.au
two) and this can be changed dynamically during program operation by setting the OSCFRQ register.
There is also a low-frequency
oscillator which runs at a nominal
31.25kHz; this is used for the watchdog timer and can even be used as
the main system clock, allowing the
high-frequency oscillator to be completely shut down to save power.
The PIC16F152xx family is an interesting group of parts. Despite only having the most basic of peripherals, they
do have some useful processor features, and they are generally excellent
value for money. Still, as we noted, you
may need to upgrade your software
and programmer to work with them.
A new hope
While reading the data sheet for the
PIC16F15214, we came across a page
describing a future PIC microcontroller family, the PIC16F171xx. Among
other features, these will boast a 12-bit
ADC (analog-to-digital converter)
peripheral. That alone would add a
noticeable boost in accuracy for our
SMD Test Tweezers design.
This family of devices should
appear in mid-to-late 2022 (with the
usual caveats about availability under
the current circumstances). We will
definitely try to get our hands on some,
and will likely start using them in projSC
ects in late 2022 or early 2023.
The PIC16F17146-E/P is one of the
upcoming 8-bit PICs from Microchip.
It boasts a 12-bit differential ADC.
Australia's electronics magazine
Are your copies of SILICON
CHIP getting damaged
or dog-eared just lying
around in a cupboard or on
a shelf? Can you quickly
find a particular issue that
you need to refer to?
Keep your copies
safe, secure and
always available with
these handy binders
These binders will protect your
copies of S ILICON C HIP. They
feature heavy-board covers, hold
12 issues & will look great on
your bookshelf.
H 80mm internal width
H SILICON CHIP logo printed in
gold-coloured lettering on
spine & cover
Silicon Chip Publications
PO Box 139
Collaroy Beach 2097
Order online from www.
siliconchip.com.au/Shop/4
or call (02) 9939 3295
and quote your credit card
number. *See website for
delivery prices.
April 2022 81
|