Course M338
Multitasking without an operating system on
8 bit, 16 bit and 32 bit Microchip Microcontrollers (PIC16, PIC18,
dsPIC, PIC24, PIC32)
Multitasking without an operating system on 8 bit, 16 bit and 32 bit Microchip Microcontrollers (PIC16, PIC18, dsPIC, PIC24, PIC32)
Duration: 5 Days
Intended Audience
This course is aimed at experienced embedded systems C programmers who wish to explore systematic approaches to implementing standalone multitasking applications on PIC microcontrollers without using an embbedded OS / RTOS. It covers the use of Finite State Machine approaches to the design and implementation of multitasking systems, polling and interrupt driven multitasking patterns, and the use of timers to achieve periodic and deterministic behaviour. It also covers multitasking approaches based on the PONT scheduler pattern.
Attendees are expected to have considerable familiarity with C programming, as well as some experience of working on embedded systems.
Course Overview
The course will provide an introduction to classical multitasking techniques that are very widely used in embedded systems application development,
Key Skills
On completing the course delegates will
- Industry standard multitasking programming techniques for small and mid-sized embedded systems
- Analysis and design approaches to the design of embedded multitasking applications
- Use Case Analysis techniques for the specification and analysis of embedded multitasking applications
- Techniques for realising Finite State Machine designs in C code
- Implementation of simple timer interrupt driven schedulers using the PONT idiom
- Appreciate the differences between pre-emptive and co-operative multi-tasking approaches
Course Contents
Multitasking and Embedded Systems - Basic Concepts
- Polling approaches to multitasking
- Interrupt driven approaches to multitasking
- Periodic polled multitasking
- Mosaic scheduler approaches to polling loop multitasking
- Hybrid systems that combine polling and interrupts
- Pre-emptive vs. co-operative multitasking
- Complexities introduced by pre-emptive multitasking
Use Case Analysis and the design of multi-tasking systems
- Overview UML and Use Case Analysis
- Use Case Analysis and Requirements Analysis
- Elaborating textual use case descriptions and scenarios using UML Diagrams
- Sequence Diagrams
- Finite Statemachines and Statecharts
- Timing Diagrams
- Activity Diagrams
Modeling Tasks Using Finite State Machines
- Problems that can be modeled in terms of States, EventsActions and Transitions
- Problems in which a state is associated with some ongoing processing
- Procedural implementation of event driven Finite State Machines (FSMs)
- Table driven implementation of FSMs
- Extending FSMs with variables and conditional transitions
- Designing distributed control applications using communicating extended FSMs
- Skip counters and handling of tasks with widely differing timing requirements
Statecharts
- Nesting of State Machines - Pushdown Automata
- Modeling concurrency and multi-tasking using Statecharts
- Converting Statechart designs into code
- Using statecharts to design, test and implement user interfaces
Implementing simple deterministic schedulers
- Simple timer interrupt driven schedulers
- PONT scheduler - design and implementation
- Handling high priority tasks in the timer interrupt handler
- Adapting the PONT scheduler for scheduling distributed tasks
Introduction to working with a multi-tasking Embedded OS
- FreeRTOS as an example embedded operating system
- Overview of task scheduling in FreeRTOS
- Multi-tasking and inter-process communication
- Controlling access to resources shared between tasks - semaphores and critical sections
