mbed (see mbed.org) is a next-generation tool for rapid prototyping with modern 32-bit ARM Cortex microcontrollers. The biggest innovation of mbed is the cloud-based development environment. The entire system—editor, compiler, libraries, and reference materials—are completely web-based. There is no software to install or maintain on the host system.
However, programming the mbed microcontroller (NXP LPC1768 ARM Cortex-M3) remains a challenge. Even though most mbed programs and libraries use quite well designed object-oriented interfaces, the programs are still written in a sequential manner, which means that whenever a program needs to synchronize with some external event, such as a button press, arrival of a byte through the serial port, or a time delay, it explicitly waits in-line for the occurrence of the event. Waiting "in-line" means that the processor spends all of its cycles constantly checking for some condition in a tight loop (called the polling loop).
Although this approach is functional in many situations, it doesn't work very well when there are multiple possible sources of events whose arrival times and order you cannot predict and where it is important to handle the events in a timely manner. The fundamental problem is that while a sequential program is waiting for one kind of event (e.g., a button press), it is not doing any other work and is not responsive to other events (e.g., characters from the serial port).
Another big problem with the sequential program structure is wastefulness in terms of power dissipation. Regardless of how much or how little actual work is being done, the microcontroller is always running at top speed, which drains the battery quickly and prevents you from making truly long-lasting battery-powered devices.
Modern Event-Driven Programming for mbed
For these and other reasons experienced programmers turn to the long-know design strategy called event-driven programming, which requires a distinctly different way of thinking than conventional sequential programs. All event-driven programs are naturally divided into the application, which actually handles the events, and the supervisory event-driven infrastructure (framework), which waits for events and dispatches them to the application. The control resides in the event-driven framework, so from the application standpoint, the control is inverted compared to a traditional sequential program.
It turns out that the QP™/C++ state machine framework beautifully complements the mbed platform and provides everything you need to build responsive, robust, and power-efficient mbed programs based on modern hierarchical state machines and the preemptive QK kernel. In many ways the open source QP/C++ state machine framework is like a modern real-time operating system (RTOS) specifically designed for executing event-driven state machines. The free QM™ graphical modeling tool takes mbed programming to the next level, by eabling automiatic code generation of the embedded code.
The QP/C++ Development Kit (QDK) for mbed is different from most other QDKs in that it is self-contained and includes the simplified and compacted source-code version of the QP/C++ framework. The QDK-mbed is designed to import directly into the mbed web-based compiler to become immediately useful without building a binary library. The mbed notebook pages describe the main concepts and how to get started.
QP™ Development Kits (QDKs) for mbed
|QP/C++ for mbed||mbed 1768||QP/C++ 4.5.02||mbed compiler (ARM RVDS 4.1)||mbed Notebook page||QP library|
|DPP example||mbed 1768||QP/C++ 4.5.02||mbed compiler (ARM RVDS 4.1)||mbed Notebook page||qp_dpp program|
Related Development KitsQP Development Kits for ARM
Last updated: September 06, 2012