Page 380 - ARM Based Microcontroller Projects Using MBED
P. 380

366                             15. Mbed RTOS PROJECTS













                 FIG. 15.2  Example Round Robin scheduling with three tasks.












                 FIG. 15.3  Example IB scheduling with three tasks.

                 scheduling are that it is complex to implement, and also there is too much overhead in terms
                 of context saving and restoring. Fig. 15.3 shows an example IB type scheduling with three
                 tasks where Task1 has the lowest priority and Task2 has the highest priority.



                                    15.3 Mbed RTOS IMPLEMENTATION

                   One of the nice features of Mbed is that it supports preemptive interrupt-based scheduling.
                 Several tasks can be given different priorities, they can be scheduled to start, stop, commu-
                 nicate with other, and share resources. We shall be developing several multitasking projects
                 in the next sections using various Mbed RTOS functions. Note that the RTOS features described
                 in this book refer to Mbed OS 2. Other OS versions may have different functions and features.



                  15.4 PROJECT 1—DIFFERENT FLASHING A PAIR OF LEDs—USING
                                                 Mbed THREAD

                 15.4.1 Description

                   In this project two LEDs (LEDA and LEDB) are connected to the Nucleo-F411RE develop-
                 ment board. The project flashes LEDA every second, and LEDB every 0.5s.


                 15.4.2 Aim

                   This is a multitasking project having two tasks. The aim of this project is to show how two
                 tasks can be created using Mbed function Thread.
   375   376   377   378   379   380   381   382   383   384   385