First Technology Transfer

Standard and Advanced Technical Training, Consultancy and Mentoring

Course M208 - Multi-tasking and Finite State Machine driven application development with Microchip 16 bit Microcontrollers

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. Attendees are expected to have considerable familiarity with C programming, as well as experience of working on embedded systems.


The course 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. The course will use the MPLABX IDE and the XC16 compiler The course will provide an introduction to classical multitasking techniques that are very widely used in embedded systems application development. Key topics covered will include

  • 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
  • The differences between pre-emptive and co-operative multi-tasking approaches

Course Outline

  • 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