At present, 8-bit single-chip microcomputers still occupy an important position in the field of measurement and control and the application of intelligent electronic products. The application of embedded real-time operating system (ERTOS) will greatly facilitate the software development of 8-bit single-chip microcomputers. This article briefly introduces the embedded real-time operating system and its advantages in program design, focusing on the embedded real-time operating system Small RTOS51 suitable for small RAM single-chip microcomputers, as well as the design methods and processes of hardware and software based on 8-bit single-chip microcomputers.
1 Introduction to embedded real-time operating system Small RTOS51
Embedded systems have become one of the hot topics today. From consumer electronics to various industrial equipment, embedded systems have penetrated into every corner of daily life. For embedded systems, an important feature is real-time performance, that is, completing the specified functions within a certain time and being able to respond correctly to external asynchronous events. To ensure the real-time performance of the system, the cooperation of software and hardware is required. First of all, it is necessary to ensure that the hardware processing speed meets the real-time requirements, and for software, it is to use an embedded real-time operating system (Embedded Real_Time Operating System, ERTOS) that is compatible with it.
The use of embedded real-time operating system (ERTOS) can ensure the real-time switching of tasks in the system, the determinism of event response time and the high reliability of the system. At the same time, ERTOS regards user applications as multiple tasks running on it, which provides great convenience for program writing, debugging and expansion of system functions. In addition, due to the use of ERTOS, the application software is objectively independent of the underlying hardware environment, which is convenient for the transplantation of embedded software, thus greatly reducing the system development cost and development cycle. At present, there are many kinds of embedded real-time operating systems that have been launched, and the more commonly used ones are VxWorks, WinCE, VRTX, pSOS, Palm OS, embedded Linux, Delta OS, etc. For the 8051 series of single-chip microcomputers, due to the small amount of RAM and ROM, the most suitable operating system for this type of single-chip microcomputer is Small RTOS51, which uses the stack management mechanism of RTX Tiny brought by Keil C51 and is preemptive like μC/OS-Ⅱ. At present, the latest version of Small RTOS is 1.20.3, which can support dynamic creation and deletion of tasks, reentry functions of C51, dynamic memory allocation, etc.
2 Embedded thermostat
2.1 Structure and principle of embedded thermostat
The system structure of the thermostat based on 8-bit single-chip microcomputer implemented by Small RTOS51 is shown in Figure 1. The single-chip microcomputer is the control core, which is responsible for reading the temperature of the temperature sensor and outputting it to the LED display. The button is used to set the temperature of the thermostat. When the temperature exceeds the limit, the output control part outputs the control signal to drive the relay or alarm device. The power supply part supplies power to the entire system.
2.2 Embedded temperature controller hardware circuit
Since the peripheral circuit of the temperature controller is relatively simple and the main controller requires few input/output ports, Atmel's AT89C2051 is used. The temperature sensor uses the DS18B20 of DALLAS Semiconductor, USA. Its data signal line is connected to the microcontroller P3.7. The LED display is composed of 4 common cathode digital tubes, driven by 4 serial input and parallel output shift registers 74LS164. It adopts static display mode. P1.1 is used as the serial data input of the LED display, and P1.0 is used as the serial clock input of the LED display. The output control signal is output by P1.7 to control the PNP transistor. In addition, 4 buttons are set to connect to P3.2~P3.5 of the microcontroller respectively. Its hardware circuit is shown in Figure 2.
3 System software design
3.1 Task decomposition and division
Task division includes determining which transformations belong to which task and determining the priority of each task. The specific division principle can be found in reference [1]. According to the principle of task division and the specific functions of the embedded temperature controller, this system decomposes the task into three tasks: key display processing, temperature measurement, and output execution.
3.2 System software design
System software design mainly includes main program design and task program design.
The main program flow chart of this design is shown in Figure 3. After the main program is initialized, three tasks are established in sequence and the CPU enters the sleep state. After each task runs, it first enters the task sleep state and waits for the corresponding task to wake up. After the task is awakened, it performs corresponding processing and enters the sleep state again. Each task adopts an infinite loop structure, which is as follows:
Task wakeup is completed by the function OSTaskResume(TASK_ID). Create a project under KeilμVision 2, edit the corresponding header file config.h, and set the relevant contents of OS_CFG.h and OS_CPU.h accordingly, and compile until success.
4 Conclusion
According to the hardware circuit of the embedded thermostat, the embedded real-time operating system Small RTOS51 is used to program it. KeilμVision 2 is used to build the project and compile it. After downloading the code, the thermostat works normally. For the 8-bit microcontroller that is still widely used, it is simple and convenient to use Small RTOS51 for program design. By using interrupts, semaphores, and message queues, more functions and effects can be achieved; in addition, there are many real-time operating systems, but their principles are similar. If you understand one of them, you can draw inferences from it and understand and apply other embedded real-time operating systems.
Previous article:Design of image processing system based on ISP technology and 89C55 single chip microcomputer
Next article:Design of Thyristor Trigger Based on AT89C52 Single Chip Microcomputer
Recommended ReadingLatest update time:2024-11-16 17:38
- Popular Resources
- Popular amplifiers
- Practical Development of Automotive FlexRay Bus System (Written by Wu Baoxin, Guo Yonghong, Cao Yi, Zhao Dongyang, etc.)
- CVPR 2023 Paper Summary: Video: Low-Level Analysis, Motion, and Tracking
- CVPR 2023 Paper Summary: Efficient and Scalable Vision
- IC packaging basics and engineering design examples
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Intel Agilex M Series released! FPGA has better transmission layer efficiency and higher resource utilization
- ETU Configuration for CPU Card Programming
- MSP430 MCU printf function transplantation
- Disassembling Panasonic's antique tape recorder and analyzing its circuit design 50 years ago
- DSP clock and timer general timer
- Custom MMIC Blog: From Mixers to Phased Array Radar
- CC26xx BLE adds characteristic value of indication attribute
- Answer the questions to win prizes | Shijian Exploration: Smoke detection empowers smart buildings
- Todd Gillenwater talks about why he is optimistic about UWB technology
- Embedded Linux boutique resources, with source code comments