Book: Practical UML Statecharts in C/C++, 2nd Ed

Event-Driven Programming for Embedded Systems

by Miro Samek, Ph.D.
share on: 

The second edition of the “Practical Statecharts” book by Quantum Leaps’ Miro Samek bridges the gap between high-level abstract concepts of the Unified Modeling Language (UML) and the actual programming aspects of modern finite state machines (UML statecharts). The book describes a lightweight, open source, event-driven real-time embedded framework (RTEF) called QP™ that enables a straightforward implementation of UML statecharts and concurrent event-driven applications in C or C++.

Publication Date October 1, 2008
Publisher Newnes
ISBN-10 0750687061
ISBN-13 978-0750687065
Available Formats Paperback, Hard-Cover, Kindle, PDF (see below)
Free Downloads Download complete book in PDF
Also available from Most online book sellers, such as,
and many others

Chinese Translation

Updates + Errata

Cross-referenced error corrections and changes made to the QP frameworks since the publication of the book. The PDF document is searchable by page number, section number, and update type. Last updated for QP 4.3.00 (09-Jan-2012).

Resources and Tools for the Book

The following sections provide the links for downloading all the software and tools used in the book as well as other resources.
QP real-time embedded framework (RTEF)

QP™ Real-Time Embedded Frameworks (Version 4)

QP™/C and QP™/C++ Real-Time Embedded Frameworks (RTEFs) described in the book. The downloads below contain the QP framework source code and all examples described in the book.

QM™ Modeling-Based Design Tool

Since the publication of the book, a new modeling tool called QM™ (QP Modeler) has been developed to support graphical modeling based on the QP frameworks. QM provides intuitive diagramming environment for finite state machines (UML statecharts) and automatically generates production-quality C or C++ code.
QM modeling tool for state machines
QTools collection

QTools™ Collection

The QTools™ collection contains various open source tools for working with the QP frameworks, such as: (1) QSPY host application, (2) QUTest unit testing harness, (3) QView monitoring and visualization, (4) QWin prototyping, (5) QCLEAN for cleanup of source code files. The QTools collection for Windows provides also the free open-source C/C++ GNU compiler for Windows (MinGW) as well as the GNU make for Windows and related file utilities (rm, touch, etc.)

EFM32-SLSTK3401A board

To demonstrate modern embedded systems programming with QP, the accompanying code includes examples for the inexpensive ARM Corterx-M4F-based EFM32-SLSTK3401A evaluation kit (also known as Pearl Gecko Starter Kit) form Silicon Labs.

NOTE: The EFM32-SLSTK3401A board is the replacement for the EK-LM3S811 board, which has been discontinued.

Board: EFM32-SLSTK3401A Pearl Gecko
MS-DOS logo

DOS Replaced with Windows

All examples for the legacy 16-bit DOS in the book are replaced in the latest QP frameworks with examples for Windows. This includes the “Fly ‘n’ Shoot” game example (Chapters 1 and 12), which runs as a Windows GUI application. The Windows examples are located in the directory /examples/workstation/, where denotes the directory into which you have installed QP/C or QP/C++.

Visio Stencil

All diagrams in the book have been prepared in Microsoft Visio-2003. The Visio stencil used to make the diagrams is available for a free download below. The Software-UML.vss stencil should work with the newer versions of Visio.
Visio stencil download for the book Practical Statecharts in C/C++