Video: State Machines

Publish Date: Aug 18, 2008 | 18 Ratings | 3.72 out of 5 |  PDF

Overview

The state machine is one of the fundamental architectures NI LabVIEW developers frequently use to build applications quickly. Developers use state machines in applications where distinguishable states exist. Each state can lead to one or multiple states and can end the process flow. A state machine relies on user input or in-state calculation to determine which state to go to next. Many applications require an “initialize” state followed by a default state, where you can perform many different actions. These actions depend on previous and current inputs as well as states. You can use a “shutdown” state to perform cleanup actions.

In LabVIEW software, you can create a basic state machine with a while loop, a shift register, a case statement, and some form of case selector (case selectors are discussed in a later section). The while loop is the main program loop, which executes until the conditions for exiting the program are met. The while loop’s main responsibility is to call the case selector and then execute the appropriate case. The shift register keeps track of which case should execute next. Finally, each case of the case statement contains the action for one specific use action. Often the default case is used as the place to check the case selector (in other words, if the user did nothing, check again to see if he has done something yet).

Video


Tutorial           Exercise          State Machine          Modules Home          FIRST Community

Back to Top

Bookmark & Share

Ratings

Rate this document

Answered Your Question?
Yes No

Submit