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

LabVIEW State Machine Example

This document provides instructions for creating a simple state machine program in LabVIEW. It describes using a case structure inside a while loop to handle different program states and transitions between them. A shift register is used to save data between states. Users can start and stop an engine simulation by pushing buttons, and exit the program with another button. Steps are provided to build the front panel, add a while loop and case structure, and program the button events to trigger state changes.

Uploaded by

Nguyễn Long
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

LabVIEW State Machine Example

This document provides instructions for creating a simple state machine program in LabVIEW. It describes using a case structure inside a while loop to handle different program states and transitions between them. A shift register is used to save data between states. Users can start and stop an engine simulation by pushing buttons, and exit the program with another button. Steps are provided to build the front panel, add a while loop and case structure, and program the button events to trigger state changes.

Uploaded by

Nguyễn Long
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


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

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.
Hans-Petter Halvorsen Blog: http://home.hit.no/~hansha/

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:

You might also like