0% found this document useful (0 votes)
248 views

LabVIEW State Machine Example

This document provides instructions for creating a simple state machine program in LabVIEW. The state machine will control an engine light that turns on when the "Start Engine" button is pressed and off when the "Stop Engine" button is pressed. It will exit when the "Exit" button is pressed. The instructions outline 7 steps to build the program, including creating the front panel, adding a while loop and case structure, adding a shift register, and programming the different button events to control the engine light state.

Uploaded by

malek
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
248 views

LabVIEW State Machine Example

This document provides instructions for creating a simple state machine program in LabVIEW. The state machine will control an engine light that turns on when the "Start Engine" button is pressed and off when the "Stop Engine" button is pressed. It will exit when the "Exit" button is pressed. The instructions outline 7 steps to build the program, including creating the front panel, adding a while loop and case structure, adding a shift register, and programming the different button events to control the engine light state.

Uploaded by

malek
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Telemark University College

Department of Electrical Engineering, Information Technology and Cybernetics

LabVIEW State Machine Example


Description: The state machine is one of the fundamental architectures LabVIEW developers frequently use to
build applications quickly. The State Machine approach in LabVIEW uses a Case structure inside a While loop to
handle the different states in the program, and the transitions between them. A Shift Register is used to save
data from and between the different states.
Task: Create a simple program in LabVIEW using the State Machine approach. The User Interface (Front Panel)
should look something like this:

When the user push the Start Engine button, the light gets on and when the user push the Stop Engine
button, the light gets off. When the user pushes the Exit button, the program will stop.
The Procedure is as follows:
Step 1: Create a New VI (FileNew VI) (Blank VI)

Step 2: Create your Front Panel as in the Example above.

Step 3: Add a While Loop to your VI

Step 4: Add a Case Structure to your VI inside the While Loop


Step 5: Add a Shift Register to your While Loop by right-click on the While Loop and select Add Shift Register.

Faculty of Technology, Postboks 203, Kjlnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01

Step 6: Add a Case called Wait in your Case Structure. Create an Event Structure inside this case. Add Event for
your 3 different buttons; Start Engine, Stop Engine and Exit.

Step 7: Finish the Code.


Here is an extract of the program:

Hans-Petter Halvorsen Blog: http://home.hit.no/~hansha/

You might also like