Member #148178

Member Since: August 25, 2010

Country: United States

  • I also come from a hardware background and when I began programming state machines the most difficult part was how to actually draw the state machines. However, once I figured out that the state transitions should be some sort or event (button press, timer tick, message received, etc) it made things a lot easier.After that I was constructing state machines using the good ‘ol switch statement.

    Then I came across this interesting post and my whole paradigm shifted forever. Instead of constructing a state machine in switch statement I now write them in a table. It is so much easier to read, easier to edit, easier to debug. With more then just a few states the switch statement quickly gets out of control and unmanageable. With the ‘table-driven’ method everything is much cleaner. Sometimes a switch statement is just great especially where the processing is simple and needs to be very fast, but for more complex application level state machines the ‘table-driven’ method is king!


    That video helped me out. Also, the data sheet and user manual above are fairly detailed.

No public wish lists :(