New pattern for implementation of hierarchical state machines in the c language, optimized for minimal execution time on microcontrollers

P. Romaniuk · International Conference Mixed Design of Integrated Circuits and Systems · 2008

The paper presents a new design pattern for implementation of hierarchical state machines in the C language. The proposed solution bases on tables of pointers to functions. The work is focused on minimizing execution time, but the demand for memory is also discussed. The pattern is tested and compared against a reference one (Quantum Platform Nano) that allows creating fast running code. This reference has very good time profile comparing with other well known solutions. On the example of a state machine with various types of transitions, the time characteristics of both patterns are measured and expressed in means of quantitative parameters: total event processing time, latency and compactness of responding actions. Results of the evaluation procedure prove that the new pattern works faster (by up to 44%) leaving more time for processing other tasks. Although the structure was optimized and tested on 8-bit AVR microcontrollers, some conclusions may be generalized for architectures that are more powerful. The developed pattern extends the previously published tool for automatic code generation from UML.

Read the paper · More papers on PaperTik