Page 45 - Designing Autonomous Mobile Robots : Inside the Mindo f an Intellegent Machine
P. 45

Chapter 3

            Kernels and tasks

            Real-time software concepts are almost as old as conventional programming con-
            cepts. A software program that allows the machine resources to be divided between
            multiple tasks is called a real-time kernel. The name kernel is appropriate because a
            kernel is the small but critical center of the programming environment. It is basi-
            cally a task switch.
            A real-time operating system contains a kernel and the basic disk, keyboard, mouse,
            and communications facilities found in conventional operating systems. Special
            microcomputer systems designed for factory automation sported simple real-time
            operating systems as early as the 1970s.


                               Serial Input Interrupt



                            Push Registers on Stack_0


                           Swap Stack Pointer to access
                                   Stack_1

                               Get Serial Byte from
                               UART into Register A         Get Character
                                                              Subroutine

                            Return from subroutine into
                                 serial program             Push Registers
                                                             onto Stack_1
                                                                    text

                                                            Call Serial Task
                                Serial Task Exit
                                                                Exit
                            Swap Stack Pointer back to      Pop Registers
                                   Stack_0                   from Stack_1


                                                             Return from
                            Pop Registers off of Stack_0
                                                             Subroutine w/
                                                              Character
                              Return from Interrupt

                            Main Program Thread           Communications Thread

                          Figure 3.3. A simple multitasking serial input routine



                                                    28
   40   41   42   43   44   45   46   47   48   49   50