Nowadays, two methods are adopted by the researchers who develop the 8-bit MCU's applications, one is to run program on the chip directly, and another is to add simple interrupt routines to cycle structure. Nevertheless, with the enhancement of capability of the 8-bit MCU and the complexity of program in embedded systems, the known design methods can't satisfy the current requirements of the realistic applications. Therefore, real-time operating system is introduced into applications, which can accomplish resource management and task scheduling, boost up the stability of the system and reduce the developers' workload.Firstly, relative knowledge, the key features and the basic functions of embedded real-time operating system are introduced. Secondly, some main design and implementation details ofμCRTOS, such as task management, interrupt management, time management, synchronization and communications between the tasks and memory management are described. Task management is the core ofμCRTOS. A new mix strategy of task scheduling is proposed based on analysis of the existed strategies of task scheduling. This strategy divides the tasks into preemptive group and non-preemptive group in order to reduce the time of switching tasks which can't be differentiated in urgent degree.μCRTOS uses semaphore and message queue mechanism to realize the synchronizations and communications between tasks. And the memory allocation and release in memory management are designed in order to satisfy the real-time requirements of the embedded system. Finally, the test scheme ofμCRTOS is proposed and test results are presented.KeilμVision2 is selected as the software development environment for the design ofμCRTOS, and MCS-51 is used as the hardware platform for the system validation. The test results show thatμCRTOS is stable, and the anticipative goals are achieved. |