1. We will be in Read Only mode (no new threads, replies, registration) starting at 9:00 EDT for a number of hours as we migrate the forums to upgraded software.

State Macine on PIC

Discussion in 'Programmer's Corner' started by mlkcampion, Jan 19, 2007.

  1. mlkcampion

    Thread Starter Active Member

    Nov 16, 2006
    59
    0
    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.

    Thanks
     
  2. hgmjr

    Retired Moderator

    Jan 28, 2005
    9,029
    219
    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.

    hgmjr
     
  3. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    6
    Another article.

    When you have had a read and still have questions, post the specifics and we could go forward from there.
     
Loading...