02-09-2020 | | By Robin Mitchell
8-bit microcontrollers have been around since the early 80s and have played a central role in modernising electronics. What are 8-bit microcontrollers, how do they compare to modern microcontrollers being produced, and are they still relevant?
Microcontrollers are similar to system-on-chips (SoCs) which generally incorporate a CPU, memory, and peripherals requiring no external hardware to assist with computation. A microprocessor, however, is only the CPU and requires external memory, controllers, and interfaces to be usable. The term “8-bit” generally refers to the bit-width of the CPU. Thus an 8-bit microcontroller is one which contains an 8-bit CPU. This means that internal operations are done on 8-bit numbers, that stored variables are in 8-bit blocks, and external I/O (inputs/outputs) is accessed via 8-bit busses. However, some microcontrollers such as the PIC18 range are 8-bit micros, but their instruction memory uses 14-bits (however, the RAM section is still 8-bits in width).
As technology progresses, the capabilities of the latest CPUs increase and the increase in bit size has always been highly sought after. As such, the performance of 8-bit microcontrollers vs 32-bit versions will differ. The first processor, the Intel 4004, was a 4-bit CPU, and the introduction of the Intel 8008 saw the majority of designers move to the 8-bit realm. When Intel introduced the 8086, computer designers (such as IBM), again moved to the higher bit-count due to its ability to work on larger numbers, access more memory, and perform more complex operations. However, despite mainstream computers continually utilising the latest technology, a large market utilised 8-bit technology from the late 70s into the early 90s: the home computer. Increasing the bit-width of a CPU does improve a computer's performance, but for basic tasks, 8-bits is often sufficient, including word processing, games, music development, spreadsheets, and task management. The abilities of 8-bit technology, combined with decreasing costs of electronics, has seen 8-bit microcontrollers remain relevant well into modern life. So, how do typical 8-bit microcontrollers compare to modern microcontrollers?
Modern microcontrollers come in all shapes and sizes, with some integrating incredibly complex features including multiple cores, advanced hardware security, and internet capabilities. However, these same devices can be costly, and so it is important to compare like for like. A typical example of a modern microcontroller would be the STM32 range which use 32-bit ARM cores, includes a wide range of features including I2C, SPI, and DMA controllers, all while being cheaper than many other 8-bit microcontrollers. For comparison, the PIC18 range is 8-bit microcontrollers that include a rich set of peripherals, contain similar amounts of memory (generally 16K ROM and 8K RAM), and housed in equally small packages. The AVR range of 8-bit microcontrollers also have similar capabilities to the PIC18 range, and it is the ATmega328 that powers the famous Arduino Uno.
So, with the exception of a larger bit-width CPU, low-end 32-bit microcontrollers offer very little extra when compared to 8-bit microcontrollers capable of performing the same task; in fact, they can result in over-complication of a project.
While it is technically possible to program 32-bit microcontrollers in assembly, it is an incredibly complex task (if not near impossible). Almost all projects for 32-bit designs are exclusively done in IDEs that use peripheral setup tools, pin configurators, and code the microcontroller in high-level languages such as C++. Most projects will work entirely in C++, but some projects will have strict timing requirements, which are often not achievable in C++. 8-bit microcontrollers are often designed to be coded in assembler, and thus their programming environments are geared towards assembler. This makes it easier to count clock cycles, and thus create time-critical routines. While assembler routines can be inserted into C++, it is not often easy to mix the two, and this is where the second issue comes in with modern 32-bit microcontrollers; complex peripherals.
8-bit microcontrollers such as the PIC18 and ATmega range have clearly defined documentation that explains every detail about a specific microcontroller, including its instruction set, in a single document. This makes it very easy to use peripherals in either C or assembly, and there is often no need for additional tools to configure peripherals. 32-bit microcontrollers, however, are often very obscure in operation, and trying to use the simplest peripheral can be a monumental task. This is further made more complicated when documentation is spread across many different documents, and clear working examples are hard to find. The simplistic nature of 8-bit devices has created a pool of online resources that anyone can access and be easily understood, but 32-bit devices don’t often find their way into everyday projects.
However, IoT devices are an exception to this rule, but it should be noted that they cannot be easily compared to 8-bit microcontrollers. One example of such a device is the ESP32; this integrates a 32-bit microcontroller with Wi-Fi capabilities, multiple peripherals, and a clock speed of up to 240MHz. However, the ESP32 is difficult to use in prototyping without using a premade module that includes support hardware, programming port, and I/O pins. In contrast, most 8-bit micros are available in DIP-packages. Such IoT devices also suffer the same issues as other 32-bit microcontrollers; they are not ideal for assembly programming, can be complex to utilise peripherals, but unlike their counterparts, are much more expensive than most 8-bit microcontrollers.
What matters most is what applications 8-bit microcontrollers can be used in. Generally speaking, if a device does not need to connect to the internet, or does not have strong security requirements, then an 8-bit microcontroller can almost always be used. While 8-bit numbers are limited in size, large numbers can be broken down into multiple steps, and this is something that C compilers handle (of course, this can still be done in assembler). Therefore, any application that requires the utilisation of numbers greater than 255 can still be achieved with an 8-bit microcontroller.
While 8-bit microcontrollers themselves generally don’t come with internet capabilities, they can still be easily connected to external peripherals such as ethernet controllers and Wi-Fi bridges to provide a connection. However, modern security practices would require that the peripheral(s) providing internet access utilises strong security mechanism, and any communication between the 8-bit microcontroller and the internet service utilises strong encryption. This may be tricky for 8-bit microcontrollers due to the high memory requirements of encryption algorithms, so using a peripheral that can handle this would be ideal.
As technology continues to progress, 8-bit microcontrollers will eventually be phased out. However, the industry shows no sign of a reduction in 8-bit usage, and their low-cost nature combined with simplicity still make them highly relevant. No matter the application, 8-bit devices will always find a purpose, so don’t be too quick to throw away your PICKIT3, Arduino, or AVR programmer!