State Macine on PIC

Thread Starter


Joined Nov 16, 2006
Hey Forum
anyone know of a good website that explains how to implement
a state machine. I just need a few notes on there general structure
and how best to acheive a stable and flexible program.



Joined Jan 28, 2005
Greetings mlkcampion,

I had a surprisingly difficult time googling a document that addressed the basic state-machine technique. I located this link to a document that seems to present the technique in a way that should be easily understood.

You didn't mention your programming-language of choice so I chose to look for a C-language example in hopes that you have a familiarity with C. Most though not all C-languge implementations use the "switch" construct as the basis for the state-machine. Usually a state-machine begins with generating a state-diagram or state-table.

I have found state-machine coding to be both straightforward to write and generally fairly easy to debug.

I hope this information helps advance your understanding of the technique.