Most people start learning about microcontrollers with the most basic 8-bit MCUs. Generally, the most common 8-bit microcontroller series are: the 51 series, AVR series, and PIC series.Recently, there was a discussion in a group about a question: Is there any meaning in running RTOS on a 51 microcontroller? Regarding this question, everyone has their own opinions. Below, we will specifically discuss the 51 microcontroller and RTOS.
About 8-bit Microcontrollers and Their Performance and Resources
8-bit microcontrollers can be considered classics for our generation because they have limited resources and are relatively simple, making them a must-have for many beginners.1. Types of 8-bit MicrocontrollersThere are many types of 8-bit microcontrollers, and the most well-known is the 8-bit MCU, which is a general term that usually refers to 8-bit MCUs.For example, early common microcontrollers include Intel’s 80C51 series, Atmel’s AT89C51 series, domestic Hongjing’s STC89C51 series, STM8 series, and companies like NXP and Microchip, all of which have 51 microcontrollers.In fact, many semiconductor companies that produced general-purpose MCUs had their own 51 microcontroller series, but with the emergence of 32-bit microcontrollers, many of the earlier 51 microcontrollers gradually faded from view.2. Performance of 8-bit MicrocontrollersNow let’s talk about the performance of 8-bit microcontrollers, which is mainly determined by the main frequency (or clock frequency), but there are also other factors that affect performance, such as bus width.Currently, the main frequency of 8-bit microcontrollers typically ranges from a few megahertz to several tens of megahertz. For example, the STC89C51 can reach a main frequency of up to 48M:At 48M, the speed is not low. This speed would be sufficient for running a GUI on a 32-bit MCU.However, this is on an 8-bit 51 microcontroller, and due to limitations in bus data width and the lack of preprocessing operations, its performance is still much lower compared to 32-bit microcontrollers.To put it simply, running the same program, a 51 microcontroller at 48M cannot outperform a 32-bit microcontroller (like STM32) running at the same frequency (48M).Of course, if the 51 microcontroller runs at the maximum frequency of 48M, its performance is still sufficient for running RTOS.3. Storage ResourcesWhen we talk about resources, we also include peripheral resources, such as ADC, I2C, etc. Since we are discussing RTOS here, we will mainly focus on Flash (for code storage) and RAM (for runtime storage) resources.In the early days, due to limitations in storage technology (the cost of producing Flash and RAM was very high), the resources of 51 microcontrollers were relatively small. For example, the classic AT89C51 has only: 128 bits of RAM and 4K of Flash.However, with the maturity of storage technology, the storage capacity of 51 microcontrollers has generally increased. For instance, the popular STC microcontrollers now have up to 8K of RAM and 64K of Flash.
What RTOS Can Be Used on 8-bit Microcontrollers?
Having discussed the performance and resources of 8-bit microcontrollers, let’s talk about which RTOS can run on them.Many early RTOS were adapted for popular 8-bit microcontrollers (with low-level drivers and examples), and even if they were not specifically adapted, they provided some general driver interfaces for broader use.As chip manufacturing technology has matured and demand has increased (with richer software resources and higher requirements), many RTOS have generally shifted towards 32-bit MCUs, making some RTOS less friendly to 8-bit microcontrollers.However, there are still many RTOS available for 8-bit microcontrollers, although some are relatively niche and not widely known.Examples include Small RTOS, Keil’s built-in RTX51 Tiny, and the well-known uCOS, all of which can run on 51 microcontrollers.Additionally, RTOS such as AtomThreads, Chibios, CMX-Tiny+, and embOS have been adapted for 8-bit microcontrollers.When I was learning about 8-bit microcontrollers, I ran a highly trimmed version of uCOS, and it was not a problem to run two simple tasks.
Is There Any Meaning in Running RTOS on an 8-bit MCU?
Many people might think:Now it is the era of 32-bit microcontrollers, and given the limited performance and resources of 8-bit microcontrollers, running RTOS can be quite challenging, so it seems meaningless to run RTOS on an 8-bit microcontroller.Indeed, this issue exists. However, I believe that whether it is meaningful depends on the situation. In certain cases, running RTOS on an 8-bit microcontroller can still be meaningful.1. Situations Where It Is Not MeaningfulCurrently, 32-bit MCUs do have advantages in many aspects, and 8-bit microcontrollers have inherent shortcomings. In many cases, running RTOS on a 51 microcontroller does not seem very meaningful.For example, in a large system that includes various peripheral modules and processes various business logic, it is not suitable to use an 8-bit microcontroller and run RTOS on it.Similarly, for a very simple system, such as a unit system that collects a temperature value and transmits it via serial port, using RTOS for such a simple project would unnecessarily increase the complexity of the system.2. Situations Where It Is MeaningfulI believe that the existence of something must have its significance.For learning purposes, I think it is quite meaningful, after all, the programming mindset for RTOS is quite different from that of bare-metal programming.Some beginners may have primarily mastered knowledge of the 51 microcontroller and want to learn RTOS; in this case, running RTOS on a 51 microcontroller becomes meaningful.Additionally, for a project that is not overly complex, where the peripheral modules (or resources) are used more, and the overall business logic is not too complicated and does not require handling too many events, such as temperature and humidity collection, key detection, etc., running various tasks modularly through RTOS can still be quite meaningful.In conclusion, whether it is meaningful still depends on your actual situation.ENDSource: strongerHuangCopyright belongs to the original author. If there is any infringement, please contact for removal.▍Recommended ReadingWhy do programmers leave after two years?If a programmer goes to jail, will they be assigned to write code?Oh no! An intern messed up the team’s code repository…→ Follow for more updates ←