Practical UML Statecharts in C/C++: Event-Driven Programming for Embedded Systems
R**I
Required reading for "old school" embedded systems programmers!
If you are an accomplished or aspiring embedded systems programmer and resort to the "superloop" as your foremost implementation method, you absolutely MUST read this book.While not new concepts to the industry, the concepts presented in Miro's book are certainly not commonplace in many of the embedded systems code I've seen over many years in the industry.While UML makes for a clean, now defacto standard for presenting concepts, the real beauty in Miro's book is the use of a readily-available frameworks for immediately adopting the many lessons-learned and provided in the book. These complete, well written and excellently coded frameworks are available under the GPL and an alternate, low-cost license for those who wish to keep their code private.For strong C programmers, the implementation of the frameworks is a delight as one reads through the code and is treated to an incredibly simple, lightweight and extremely powerful system that will forever put an end to your future plans to "superloop" again--albeit for any system where C (or C++) is adequately supported by the hardware. For anyone admitting that "we've always done superloop and it has always worked in the past," get ready for a real-time, highly responsive system that actually IS event driven and thrives in as little as a few bytes of RAM and perhaps a K of ROM.For those who must hold on to the "superloop is king" mindset, consider the consequences of adding to your superloop an entirely new set of features and how that may affect the timing through your loop. I started with the "dining philosophers" example code discussed in the book and ported it to my own board (using a Renesas H8S-2166 microcontroller) and augmented the code to be responsive to external events (mechanical switches). This required software debouncing. While my "example" was somewhat "trivial" in terms of what the functionality actually did, it is, in my opinion, extremely typical of changing requirements of both new and legacy code in the day-to-day evolution of embedded systems programming.My changes to the example code were to implement a "bike light" feature set. That is, whenever a switched was pressed, the bike light--if off--would illuminate. An LED on the board was used for this purpose. Pressed again, the light would blink. Pressed and held for 1 second while on or blinking, the light would turn off.The typical implementation in superloop would often require a considerate approach to ensure that the new functionality was "injected" into the "right" part of the loop, so as to be of minimal impact to other areas of critical timing code. If any kind of action within the new code delayed the loop processing, then the whole of the superloop could come under further scrutiny and therefore cause more pain as one trials and tests system responsiveness on a number of potential new fronts.Atop of this new functionality, the frameworks-provided QSpy code instrumentation system, which allows one to have a stream of information about the system states and transitions, was ported to use a UART on the H8S. Imagine adding all of this new functionality in a traditional superloop body of code. Now, imagine adding it in a matter of perhaps two hours using the frameworks AND not adversely impacting the "legacy" application code at all!One of the most beautiful aspects of these frameworks is the ability to focus strictly on the code necessary for the task at hand instead of the entire system as a whole. The frameworks substantially frees the programmer from having to manually manage system responsiveness typical of the superloop.Using UML to design and document an embedded system is relatively new to many embedded systems programmers. Miro also provides a free download stencil set for MS Visio for easily implementing statecharts, which should help those interested in pursuing the many benefits of the technology included in this book.I first met Miro at a developer's conference in San Diego, CA. One thing that comes out in his book and his discussions of this exciting technology is his passion for it. I was very interested in it, as he was displaying his software running on a very resource constrained microcontroller--all in about 40 bytes of RAM or a bit less.Drawn to his topic by his enthusiasm, I admired the frameworks even more as I began looking at the implementation and design of the code. The entire C bundle, with royalty-free 'private commerical use' license, one of either cooperative or preemptive schedulers (both are provided), event processor, code instrumentation support and more is all for under $2K. Of course, one may explore the entire frameworks for the cost of only a free download before ever making a licensing decision for a given product.Combined with the low-cost solution of using such powerful frameworks in conjunction with learning the valuable content of this book, teams everywhere can exploit the years of experience and very robust, capable code in a matter of hours instead of weeks, months and even years of doing things the "old school" way using superloops and other facilities instead of truly event-driven designs.This book and the free QF download are your entry into the 21st century of embedded systems programming. Because the code is provided in C, porting is rather easy and running on embedded systems and desktop systems is practical and easy. I was able to build and run the code as provided without modifications on my Linux, Mac and Windows systems and on the H8S and a Microchip PIC 24 with only a minimalist porting effort of about a half a day in each case. Imagine being able to run an entire real-time system that features excellent extensibility while freeing you from the rigors of managing superloop timing on your own hardware all within a few hours. Then, spend a couple of hours extending the system without impacting the rest of it? Lather, rinse, repeat...it is truly that simple and robust.Best of all, this book will open your eyes to modern methods and concepts for programming event-driven embedded systems. That is, systems that respond to internal and external events that naturally occur in all embedded systems designs. It is my firm belief that after reading this book and exploring the code on your own, you'll discover why I so heartily endorse it and now share the passion Miro has for this wonderful, very lightweight but robust, complete solution for modern embedded systems programming.
A**R
Good reading
This a good book with a probably misleading title. Still it provides a great introduction into state machine-based event-driven programming. The book is based on the authors code which functional and light weight. People who prefer learning from sample code may like the book. People who prefer learning from ground up the book may look a little bit chaotic but still it is a very good text. Nonetheless it is a big plus to have completely working source available to support the book. Though it took me some time to overcome some compiler issues and there was some outdated info about compilers in the book. At the same time to MY taste the language constructs are a bit ... awkward. So in my opinion it is not a good book to pick up a coding style. For example making default contractor private just to prevent instantiation of an "abstract" class seems a bit awkward? The same I would say about the way how object oriented programming concepts implemented in C. I also have to mention (since it is completely deemphasized in the book) that there are other ways of implementing of event-driven paradigm. I will recommend this book to seasoned programmers that want to learn a new concept or trying to refresh long forgotten. For others I would suggest to peek inside first and then decide.
M**S
True to its title (buyer beware)
Three stars only, because this book is essentially a detailed engineering design review and user guide for the author's own dual-licensed product. The treatment of UML statecharts is confined to what the same author has provided, free, on Wikipedia - and by his own admission the product does not fully implement UML statecharts. If you want to know all about the implementation and use of a particular "UML-like" statechart system in C, this is comprehensive. If you want to know about statecharts, go to the original paper by Harel, also freely available on the web. If you want to know about UML statecharts, go to the OMG website (also free). The author also explains in the book that UML statecharts are not a universal panacea - designing them is difficult, and interpretation with all their subtlties by a third party is likely to be a brain-twisting experience. Arguably if you need them, you need them bad (sic), otherwise you can probably go with something rather simpler and more intuitve.
H**Y
Book print quality was very bad and we sent it back
Book print quality was very bad and we sent it back, hoping that replaced book print is better but its the same. It looks like that the whole book is copied. Very hard to read.
D**T
Excellent Book; Poor Printing
Where the contents of this book is concerned, I'd second any of the five star reviews found on Amazon.de and Amazon.com. Simply excellent.Nevertheless, the print quality of this book is exceedingly poor. There are quite a few places in the book (especially boxes and code listings) and not least the imprint at the bottem of every page, that use various shades of grey. The result is roughly what you'd get if you printed this kind of document on your trusty laser printer - text that is roughly pixelated and hard to read. Like old newspaper photographs printed with a very rough screen.This is not state of the art printing. Newnes / Elsevier should be ashamed of it. The whole thing looks like a cheap bootleg copy made in C***a, not an original book priced at 36,00 EUR.
J**N
Grundlagen der Hierarchischen Zustandsmaschinen Referenz
Sehr gute Einführung in HSM Hiererchische Zustandsmaschinen.Dr. Samek orientiert sich dabei an der Umsetzung der UML Statecharts. Das Buch liefert anhand verschiedener Beispiele eine gut nachzuvollziehende Einführung in dieses Thema.Auf der CD befinden sich sämtliche Quelltexte und Build-Umgebungen für eine riesige Auswahl von Compilern und Zielsystemen.auf der Webseite findet man weitere Entwicklungskits für Microcontroller und Betriebssysteme.Die Beispiele auf der CD sind teilwese auch ausführbar, so dass man sich diesem Thema interaktiv nähern kann.Zum Einrichten der Entwicklungsumgebungen, zum Bauen und Ausprobieren der Beispiele sollte man sich schon mal eingehender mit den jeweiligen Compilern/IDE's beschäftigt haben.Grundkenntnisse in der Programmierung werden hier vorrausgesetzt.
M**X
gut zu lesen
Ich habe mir das buch für eine Vorlesung zu Thmea Ereignisgesteuerte Systeme gekauft. Es ist sehr angenehm geschrieben und ermöglicht durch viele leicht verständliche Beispiele einen guten Einstieg in die Thematik der Statemachines. Wenn man schon einiges weiß ist es auch als Nachschlagewerk zu gebrauchen. Ich kaufe mir nicht viele Bücher für mein Studium, dieses lohnt sich aber auf jeden Fall.
A**R
Muy baja calidad de impresion.
Muy mala calidad de impresión. Parece como si muchas de las páginas hubiesen sido impresas con una impresora con el toner bajo. Muy decepcionado, porque el libro no es precisamente barato comparado con la baja calidad del producto.
Trustpilot
1 month ago
2 weeks ago