First look at the PIC16F157x family


With a thick press release on July 20th, Microchip announced the arrival of two new  microcontroller families the PIC16F157x and the PIC16F188xx each sporting numerous (up to a dozen) part numbers. This would be an exceptional announcement from any other company, but it represent normality for Microchip. An expected performance from a company that has been cranking out new microcontroller part numbers almost in the hundreds per year.

The grand total is currently over the thousand but a more focused search, using the online product selector among 8-bit Flash models only, brings the count to 400 of which 180 belong to the PIC16F1 group (featuring the latest core).

It is a fact that such press releases are written mostly for investors and as such are significantly dumbed down in the amount of technical detail exposed but if anything, hyped up on the potential applications, which invariably include most anything in embedded control (also see image above from the original media package). This includes the Internet of Things too in case you were wondering  (see tags line).

But aside from common tags du-jour, the two families are/were significantly different and because of this more interesting than the press release might have led you to believe.

I did spend a bit of time today studying the first: PIC16F157x family and I found a few points that might interest some of you my fellow Rocket Scientists (readers). I will reserve some attention to the second: PIC16F188xx family in a future post.

To be fair, the PIC16F157x family is not completely new. The first two part numbers had been introduced as a PIC12 family (8-pin only) approximately a year ago, but the four new members in 14 and 20-pin expand significantly the usefulness of the design by adding much needed memory (Flash and RAM up to 14K and 1K respectively)  a fourth PWM channel and the flexibility of the PPS.

New Peripheral Modules

The press release did correctly mention the most important features:

  • Mixed signal peripherals: 10-bit ADC with up to 12 channels, 2x comparators, 5-bit DAC, Fixed Voltage Reference, Temperature Indicator, low power (sleep) LDO
  • Core Independent Peripherals: Complementary Waveform Generator, Peripheral Pin Select and
  • The key new feature:  four (4x) 16-bit PWM modules

The new 16-bit PWMs are quite interesting on their own. They represent quite a significant departure from the standard 10-bit PWM design that has been with us for the past two decades of 8-bit PIC models. In the first place, each new PWM module comes with its own 16-bit timer, whereas before PWM (or CCP) modules used to borrow an 8-bit timer (Timer 2) to use as the (shared) time base.

each new PWM module comes with its own 16-bit timer

As a side note, this makes the 157x the first family of 8-bit PIC microcontrollers featuring five (5) 16-bit timers (Timer1 plus the four PWM own timers/counters, PWMxTMR) in case any of you had been waiting for such a day, it is time to celebrate!

Each PWM has four (4) match-registers that allow us to control much more precisely the signal shape: a phase match controls the leading edge, a duty cycle match controls the falling edge, a period match controls the overall period and an offset allows us the stagger the output of a number of slave PWMs off the master.

There are then four PWM modes and as many offset modes to choose from. Most notably, among the four PWM modes, there is the first appearance of the Centered PWM mode in an 8-bit PIC, something that  was before reserved only to PIC24 and dsPIC models specifically designed for motor control and power supply applications.

 first appearance of the Centered PWM mode in an 8-bit PIC

New Applications

Now while the press release did list power supply and motor control among the possible applications, we must verify if such claims are supported by a correct number of peripherals to complement the PWM in such applications. In fact the new PIC16F157x models do include a Complementary Waveform Generator module (CWG) to allow us and drive a motor in a half bridge configuration, but even in the 20-pin (largest) models we find a single instance of it, which means that only a single phase motor and most likely a brushed DC one can be addressed. That is unless the latest (and more expensive) MOSFET drivers (including High side + Low side + auto headband generation) available today on the market are used.

a CWG module is available to drive a single half bridge MOSFET pair

Similarly, when attempting to apply the 157x in a power supply application, we find that the new PWMs have the smarts required to handle promptly faults, taking input from digital or analog (comparator) sources and shutting down the outputs in nanoseconds without CPU intervention. What is lacking though is the sophistication that some of the power supply applications might require including: fast comparators, higher DAC resolution, slope compensation, phase delay control and input blanking. These are features found in other PIC microcontroller families more directly targeting power supply applications such as the PIC16F752/3, PIC16F178x and the most recent PIC16F176x.

Where the new 16-bit PWMs can truly make a difference though is in Color (RGB) Lighting Applications (see the little badge demo). Here three to four of the PWMs can be used to control RGB (or RGBW when a White channel is added) LED sources with sufficient resolution to provide accurate color reproduction and to adjust the overall light output (for day/night operation).

Where the new 16-bit PWMs can truly make a difference though is in Color (RGB) Lighting Applications

In fact the theory goes that the color sensing elements in  our eyes (cones) do not distinguish more than 64 values of green (6-bit) and many fewer in the red and blue spectrum. But the ‘intensity’ sensors in our retina (rods, which are not sensitive to color) add another dimension to the whole problem. They add up more bit of resolution to the requirements of any apparatus that needs not only to reproduce all colors (in the chromaticity chart), but also to maintain a color point constant while the overall light output is reduced/dimmed.

Needless to say, when only three PWMs are dedicated to control of the RGB channels, the fourth PWM can turn out to be quite useful to implement that additional basic DC/DC conversion function that can make the whole applications so much more flexible and useful.

The presence of a LIN capable UART (EUSART) is a further hint at lighting applications in automotive (exterior indicators, DLRs, interior color “mood” lighting etc.) but also DMX based architectural, accent or stage lighting applications.

Other applications

Looking beyond what the press release suggested, I could not help it but think about digital to analog and even audio applications of the new 16-bit PWMs. A 10-bit PWM (followed by a low pass filter) can be a decent D to A converter for simple audio messaging applications, giving FM radio quality (signal to noise) output. A 16-bit PWM can significantly improve on the S/N ratio and the centered PWM modes can further reduce the harmonic content of the output that the low pass filter have to deal with.

While this could be enough to produce multiple 16-bit DACs in sensory applications, ultimately the lack of a SPI peripheral (used to retrieve PCM audio data from an SD card) and the very limited amount of flash memory available make true audio applications unlikely.  ( I still intend to run a few test someday by feeding the device via the EUSART in synchronous mode)


The impact  of the PIC16F157x family could be greatly underestimated. The new 16-bit PWM modules are worth taking a serious look as their potential is vastly unexplored. While this is no dsPIC PWM, there are new interesting possibilities being offered in color lighting applications possibly including some simple motor control and basic power supply functionality too.


This entry was posted in PIC16 and tagged , , , , . Bookmark the permalink.