I,Rtx51 tinyBrief Introduction
Rtx51 tiny is a real-time operating system (RTOs) that can be used to build applications that run multiple tasks (functions) at the same time, but from the micro perspective, it is still running independently ). Embedded application systems often have such requirements. RTOS provides scheduling, maintenance, synchronization, and other functions. The real-time operating system can flexibly schedule system resources, such as CPU and memory, and provides communication between tasks. Rtx51 tiny is a powerful RTOS and easy to use. It is used for 8051 series microcontroller. This RTOS supports up to 16 tasks. applications built based on rtx51 tiny do not have the main () function and start from task 0. The rtx51 tiny program is constructed in the Standard C language and compiled by the Keil C51 C compiler. Users can easily define task functions without complicated stack and Variable Structure Configuration. They only need to include a specified header file (rtx51tny. h ). Rtx51 tiny uses timer 0, Timer 0 interrupt, and register Group 1. If the timer 0 is used in the program, the rtx51 tiny will not work properly. You can append your timer 0 to interrupt the service program code after the timer 0 (change the configuration file conf_tny.a51 ). 2. Comparison between single-task, multi-task and rtx51 tiny programs single-task programs: Both embedded programs and Standard C Programs run from the main function. In embedded applications, main is generally an infinite loop and can be considered as a single task that runs continuously, for example:
Void main (void) {While (1) {do_something (); // run the do_something task cyclically }}
Multi-task program: Many C Programs call service functions (or tasks) in a loop to implement pseudo-multi-task scheduling. For example:
Void main (void) {While (1) {key_scan (); // scan do_key () on the keyboard; // process the key event ctr_adj (); // adjust the Controller }}
In this example, each function runs a separate operation or task, and the function (or task) runs in sequence.
When there are more and more tasks, the scheduling problem is raised naturally. For example, suppose
Ctr_adj ()If the function runs for a long time, it may take a long time for the main loop to return for running.
Key_scan ()Function, leading to the omission of some key events. Of course, it can be called more frequently in the main loop.
Key_scan ()Function to correct this problem, but at last this method still fails.
Rtx51 tiny program:
When rtx51tiny is used, an independent task function is created for each task, for example:
Void job0 (void) _ task _ 0 {OS _create_task (1); // create a task 1os_create_task (2); // create a task 2os_create_task (3 ); // Create task 3os_delete_task (0); // Delete task 0} void job1 (void) _ task _ 1 // Keyboard Scan task {While (1) {key_scan () ;}} void job2 (void) _ task _ 2 // process the key event task {While (1) {do_key () ;}} void job3 (void) _ task _ 3 // adjust the Controller task {While (1) {ctr_adj ();}}
In this example, each function is defined as an rtx51 tiny task. The rtx51 tiny program does not need the main function. Instead, rtx51 tiny starts to run from task 0. In typical applications, task 0 is used to create all other tasks.
LearningRtx51 tiny has fewer books than notebook. In fact, the best learning material is the hand notebook of the user in Keil uvision. You can open it in the following way: