A while back I was asked to work on a project that required a microcontroller to monitor a signal that determined the health of a system. The microcontroller had to fit in a tiny area and handle extreme temperature ranges. The signal to monitor was a series of pulses that had to stay within a certain time period. This is the sort of thing that any microcontroller should be able to handle very easily, assuming it could fit where I needed it and work at the temperatures required.
After looking around a bit, I ended up finding a few microcontrollers that matched the criteria for the application. One of which was the Microchip PIC16F15313. I had not used an 8-bit PIC in quite a while and remembered dealing with hassles that more modern microcontrollers do not have such as Read-Modify-Write issues, bad C compilers, poor debugging support, and sub-par peripherals.
It turns out that Microchip had continuously evolved the 8 bit PIC. The peripherals were great, the instruction set had been extended to provide easier C compiler support, the compilers were both much better and free, and debugging was easy with inexpensive tools. I ended up using that PIC16 for the project. Overall, I found the development experience refreshing, quick, and painless. The simplicity of the device allowed me to get it running quickly without dealing with buggy frameworks and the extensive peripherals available kept the code complexity to a minimum.
Fast forward a bit to the end of 2018. My house had an alarm system installed by previous owners with sensors running all over the place. At some point the service was cancelled, and the alarm company ripped out the alarm system control board, leaving the sensors and keypads in place along with a metal box full of wires stuck to the wall of a closet. The keypads hanging lifeless on the walls and box of wires that had no use bothered me every time I looked at them. I finally decided … why not use my time off at the end of the year to make my own system using the existing sensors and keypads?
Once I decided to create my own system and started to think about how I would control the various sensors, it was obvious that this was not going to require a super high performance microcontroller. All I was really doing was monitoring a bunch of switches, lighting up LEDs, and triggering buzzers. More important to me was a simple, robust, and bug free system that did not take tons of time to develop (I only have so much free time these days). Any more complicated features, such as wifi, bluetooth, logging, and remote monitoring, could be moved off to an external Raspberry PI or similar device in the future. I just had to plan for this and provide communication interfaces to future external devices.
In the end, I chose Microchip PIC 8-bit microcontrollers for my keypads, remote beepers, and master control board.
Why use an 8-bit PIC microcontroller when there are so many modern and much faster Arm Cortex-M0+ devices available for basically the same price?
- Simplicity – The 8 bit PIC/AVRs and peripherals can be up and running with only a few lines of code and no vendor provided frameworks. I have dealt with more than my share of bugs in various frameworks and prefer to avoid them unless required for really complex peripherals such as USB and ethernet. Being able to see and control exactly what registers are being set in the MCU without jumping through hoops is fantastic for quick development and troubleshooting. Simple code is easier to understand and debug.
- Errata – A simpler MCU means less extensive errata and fewer necessary work arounds.
- Deterministic execution – Simple 8 bit architectures generally do not have complex caching, prefetching, and pipelining systems. Each set of instructions takes exactly the same amount of time to execute every time.
- Package Options – 8 bit MCUs are almost unavoidable if you need to fit an MCU in a really small space with minimal external components.
- Extended Temperature Support – If you need to operate in extreme low or high temperatures, your choices are limited to various 8-bit and a few 16-bit MCUs.
- Large supported voltage range – PIC/AVR 8-bit MCUs can operate over a range of 1.8 – 5.5V. This allows direct interface to 5V parts like some LCDs and plenty of current to directly drive LEDs. This saves board space and cost. Operating at a higher voltage increases the noise immunity of the MCU at the expense of a higher power draw. Operating at a lower voltage decreases power used and allows the system to continue to run when a system requiring a higher voltage would shut down. The 8-bit MCU lets you make this decision. In my case, I ran my security system at 5V. Otherwise, I would have required both 5V and 3.3V regulators to power all the devices on the boards.
- Price – 8 bit MCUs are still a little bit less expensive than 16 and 32 bit MCUs, especially considering the features that are included for the price.
Do I think that everyone should drop their 32 bit microcontrollers and move to 8-bit microcontrollers for all their projects? No, but I do think that they should be considered far more than they seem to be when maximum performance is not required. These are not your 8-bit PICs from the 90’s!