Some simple examples of using Quantum Leaps’ QP state machine platform

Last month I inquired if anyone was using this platform as I was looking for an asynchronous state machine for project development. I noted this reference Arduino Playground - QP-nano framework but searches revealed little evidence that any hobbyist here or elsewhere were using it on an Arduino.

So I decided to hand code some simple sketches for my Duemilanove. I’ve placed these examples here: Google Code Archive - Long-term storage for Google Code Project Hosting. for anyone that might want to look into using it, or evaluating it for their own project.

I also have a blog post “Quantum Leaps’ Arduino State Machine Tutorial - Part 1“ with simple step-by-step instructions on how to get the platform up and running as yet-another-blink-without-delay sketch: Widgets and Gizmos - Wizmoz: Quantum Leaps’ Arduino State Machine Tutorial - Part 1

I’m not advocating for or against this platform, this is just a personal research project. I find these forums very informative and I wanted to return the favor by sharing my findings with others that might also be interested in understanding how to use it.

I am not associated with the company in any way.

Caveat Emptor: I’m no expert on this platform.

QP, QF, Quantum Leap, State Machine

dm

Happy to see that QP state machine platform is possible with Arduino :slight_smile:
... looking forward to see how can I use it

--- Ricky Marek.

Awesome!
Thanks dude. I've been looking for Qp framework stuff for a while now since you last post.

I'm glad others are looking at it as well.

So far I've been pretty impressed with its capabilities. It took awhile to plow through the docs and examples to get down to understanding the scheduler and inter process messaging because QP it is intended to be bundled with the Quantum Modeling UML tools. All I wanted was the bare bones non-preemptive scheduler with IPC so I could build myself a single thread asynchronous finite state machine, which is my personal choice as a controller architecture.

I built my own asynchronous device framework on top of QF and got 3 analog inputs, an I2C accelerometer and 6 digital IO's all running asynchronously in a 2.5 ms time slice. It crashed at 2ms. Everything was running in 14K and SRAM used was about 0.8K. All tasks are Run To Completion, and the max time for the 8 bit timer2 is 15ms. Anything that would block for any length of time would have to go on it's own interrupt, or one could look into the QF preemptive mode.

Anyhow, for my smart toy projects this will give me more power that I expect to need, especially with the easy inter-process communication mechanism, and it's pretty trivial to add additional devices once you get the hang of the framework.

I hope others will find my research useful.

I talk about my ADF classes here, and I've posted all of my code so others can build on it if they wish.

ddm