FSM Usage Example: Parkomat

Parkomat vending machine/point of sales system is a very convenient example, almost academic in order to illustrate how does the state machine design process look like.

Parking ticket machine is known to every driver and state machine is arguably the best way to implement the parkomats software as a high level program structure.

Here is an image representing a state machine with states and events gathered to the right, to simplify an overview and following analysis of the software.

To further facilitate the analysis and verification, states and events have been marked with letters and digits respectively.

Transition Table of the resulting Finit State Machine is to be found on the image at the bottom right corner too.

With such a picture in mind it is easy to put up a state machine software together and quickly verify it.

In a comming post it will be demonstrated how to implement this state machine using OpalApps FSM library.

OpalApps Finite State Machine Library

I have just released my next product – a lightweight and powerful Finite State Machine library (OpalApps FSM).

This platform-independent library is suitable for systems with limited computation power and targets micro controller-based applications.

The implementation has been done with simplicity and portability in mind. The library is implemented in plain C and therefore is suitable for any development environment that offers ANSI  C compiler. The library has no dependencies on other software components or libraries.

Along with source code the library package contains an example application (implementing a simplified coffee machine control) as well as unit tests of OpalApps FSM library.

The code has been substantially documented in Doxygen-compatible comment format. Doxygen configuration file is also included in the package.

Also in the package along with GNU Makefile, there is a Microsoft Visual Studio solution and project files for the library itself (to build a static library), demo application and unit testing projects.

You can find the library in my online shop.

OpalApps FSM Library