SinelaboreRT Header Logo


It's better when it's simple!

User Tools

Site Tools


UML-Tool specific Intro

Language Backends



Designers Toolbox

Integrated state-chart editor with auto-layout

Focus on modeling and not on moving states around to create a nice looking diagram! Syntax aware text fields offer a comfortable way to specify actions, guards etc. When the diagram passed the model checker it can be directly simulated. Connect the diagram to the real hardware to monitor the state machine in action.

There are better ways to model state machines than using spread sheets!

In the past different μC manufacturers have published application notes about the benefit of using state machines for the design of embedded software. An example is the application note SLAA402 from Texas Instruments (TI). It suggests to generate source code based on a spread sheet table. Nowadays several affordable UML modeling tools are available supporting the efficient design of state machines in a graphical way. SinelaboreRT generates production quality source code from state diagrams created with many different UML tools. Give it a try!

Latest Changes

Model-based testing of state machines 2020/02/23 19:32 Peter Mueller  
DCF77 Radio Clock 2020/02/23 19:27 Peter Mueller ,
Getting started with a Traffic Lights example on MSP430 - part 1 2020/02/23 19:26 Peter Mueller , , , ,
Astah SysML 2020/02/23 19:22 Peter Mueller  
Generate production quality code from state diagrams created with Enterprise Architect 2020/02/23 19:20 Peter Mueller  
Features 2020/02/23 19:18 Peter Mueller  
Generate efficient source code from UML state diagrams and activity diagrams! 2020/02/22 20:00 Peter Mueller  

Generating Lua Code

Lua is a powerful, efficient, lightweight, embeddable scripting language ( To generate Lua code call the code generator with the command line flag -l lua .

The generator generates one Lua module which implements the complete state machine. Take this simple state machine as example.

For a simple state machine with 4 states and 2 events the generated module looks like this:

function testcase:new()
        local new_inst = {}
        setmetatable( new_inst, testcase)
        -- machine states
        new_inst.states = {
        -- machine events = {
        -- Set state vars to default states
        new_inst.stateVar = new_inst.states.S1
        new_inst.stateVarS1 = new_inst.states.S11 -- set init state of S1 
        return new_inst
function testcase:processEvent(Event)
return evConsumed;
return testcase

The statemachine can be used as follows:

testcase = require "testcase"
local testcase1 = testcase:new()
Event = {event =, condition=false};

The following state machine features are supported:

  • States and sub-states
  • Deep – and flat hierarchy
  • Entry, Exit and Action code of states
  • Regions are supported and implemented as sub-functions called from the main state machine handler
  • Choice pseudo-states

The complete example is available in the examples/microwave_handbook_lua folder.

Any feedback is highly welcome!

How do you like this article?
 stars  from 1 votes

Leave your comments

Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download this .wav file to get them read to you.
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
wiki/news/14feb2020.txt · Last modified: 2020/02/15 12:14 by pmueller