Translating the state diagram into program code

Thus far you have seen how to design a Finite State Machine as an abstract diagram involving states, events, state transitions and actions. Now I shall show you how this can be translated into program code.

I will be using 2 languages, VB.NET from Microsoft and my company's SPLat language with MultiTrack. These are both nominally BASIC languages, yet the differences are quite profound. The state machine I will use is the one in figure 8. HelpTip

SPLat with MultiTrack™

This is our proprietary language, developed at SPLat Controls especially for embedded realtime machine controllers. It is heavily biased towards FSMs and multitasking.

Visual Basic .NET

I selected this because:

This link may not work forever. It is current at time of writing. If it fails you please contact me via the contact page. You should be able to find the current version by googling for "free vb.net download"

Click for a discussion of various types of realtime operating system.

Finite State diagram