
Recently, a question was discussed in the group: Is there any meaning in running RTOS on a 51 microcontroller?Regarding this question, everyone has their own opinions. Below, I will elaborate on the 51 and RTOS.
1About 8-bit Microcontrollers and Their Performance and Resources
8-bit microcontrollers can be considered classics of our generation because they have limited resources and are relatively simple, making them a popular choice 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 usually referring to 8-bit MCUs.For example, the early common ones on the market include Intel’s 80C51 series, Atmel’s AT89C51 series, domestic Hongjing’s STC89C51 series, STM8 series, and NXP, Microchip, and other companies that have 51 microcontrollers.

 In fact, many semiconductor companies that produced general-purpose MCUs had their own series of 51 microcontrollers, but with the emergence of 32-bit microcontrollers, many of the earlier 51 microcontrollers gradually faded from view.2. Performance of 8-bit MicrocontrollersNext, let’s talk about the performance of 8-bit microcontrollers, which is mainly determined by the main frequency (or clock frequency), along with other factors such as bus width.Currently, the main frequency of 8-bit microcontrollers typically ranges from several megahertz to tens of megahertz; for example, the STC89C51 can reach a main frequency of up to 48M:
In fact, many semiconductor companies that produced general-purpose MCUs had their own series of 51 microcontrollers, but with the emergence of 32-bit microcontrollers, many of the earlier 51 microcontrollers gradually faded from view.2. Performance of 8-bit MicrocontrollersNext, let’s talk about the performance of 8-bit microcontrollers, which is mainly determined by the main frequency (or clock frequency), along with other factors such as bus width.Currently, the main frequency of 8-bit microcontrollers typically ranges from several megahertz to tens of megahertz; for example, the STC89C51 can reach a main frequency of up to 48M:

With a speed of 48M, it is relatively high. At this speed, a 32-bit MCU could run a GUI without issues.However, this is on an 8-bit 51 microcontroller, and due to limitations in bus data width and the lack of pre-processing 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 machine (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 were relatively small. For example, the classic AT89C51 has only: 128 bytes 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.

2What RTOS Are Suitable for 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 selection.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 on them, and it was not a problem to run two simple tasks.
3Is There Any Meaning in Running RTOS on an 8-bit Microcontroller?
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 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 Very 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 or 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 of RTOS is quite different from that of bare-metal programming.Some beginners may have primarily mastered the knowledge of 51 microcontrollers 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, while the overall business logic is not too complicated and does not require handling too many events, such as collecting temperature and humidity transmission, or key detection in small projects,modularizing tasks through RTOS can still be quite meaningful.In conclusion, whether it is meaningful also depends on your actual situation.Source: strongerHuangCopyright belongs to the original author. If there is any infringement, please contact for removal.