Wednesday, January 13, 2010

Implementing STATE MACHINE in C

Moore Machine: A state machine which uses only Entry Actions, so that its output depends on the state, is called a Moore model. A finite state machine which produces an output for each transition.

Melay MAchine : A state machine which uses only Input Actions, so that the output depends on the state and also on inputs, is called a Mealy model. A Mealy machine has its output depend on both input and state.Shown in diagram by drawing the input/output on the edge from state 1 --->state 2

We often use mixed model.

It can be implemented in two ways

1) Nested Switch and gotos
2) Matrix for state transition Table : data of Matrix caould be Structure having new state and pointer to Action_Function (which needs to be executed )





Refer :http://www.gedan.net/2008/09/08/finite-state-machine-matrix-style-c-implementation/
http://smc.sourceforge.net/
http://sourceforge.net/projects/smc/

No comments: