0% found this document useful (0 votes)
169 views15 pages

LabVIEW State Machine

The document discusses using state machines to structure LabVIEW code. It notes that new LabVIEW programmers often put all code in a while loop without structure. A state machine uses a while loop, shift register, case structure, and selector to organize code into different states. Structuring code with state machines, a project explorer, and subVIs helps prevent code from growing uncontrolled and improves modularity, readability, and reuse. State machines are a fundamental architecture for building LabVIEW applications.

Uploaded by

iin suknia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
169 views15 pages

LabVIEW State Machine

The document discusses using state machines to structure LabVIEW code. It notes that new LabVIEW programmers often put all code in a while loop without structure. A state machine uses a while loop, shift register, case structure, and selector to organize code into different states. Structuring code with state machines, a project explorer, and subVIs helps prevent code from growing uncontrolled and improves modularity, readability, and reuse. State machines are a fundamental architecture for building LabVIEW applications.

Uploaded by

iin suknia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

https://www.halvorsen.

blog

LabVIEW
State Machine
Creating LabVIEW Applications using the State Machine Principles

Hans-Petter Halvorsen
LabVIEW
• LabVIEW is a graphical programming language
• LabVIEW has powerful features for Simulation,
Control, Vision and DAQ Applications
Resources:
• https://halvorsen.blog/documents/programming/labview/
• https://halvorsen.blog/documents/teaching/courses/labview_automation.php

2
While Loop
Basic LabVIEW Example

New LabVIEW Programmers that has


not learned about the State Machine
principles tends to put all their code
into a While loop without no structure

3
Simple LabVIEW VIs vs. LabVIEW Applications
• Typically engineers often create simple LabVIEW VIs
that eventually grow out of control, because they don't
have the proper structure and best practices.
• The solution to this problem is organizing your code
and data in a way that enables modularity, readability,
and reuse.
• Using a state machine approach is a good way to make
it right from the early beginning.

4
State Machine
The state machine is one of the fundamental architectures
LabVIEW developers frequently use to build applications

In LabVIEW software, you can create a basic state machine


with a While loop, a Shift Register, a Case Structure, and
some form of case selector
6
While Loop Case Structure

State Machine
Event Structure
Example
Shift Register

7
Structure your Code!
• Use the State Machine principles
• Use the Project Explorer
• Create and use SubVIs

8
Project Explorer

9
SubVIs

10
https://www.halvorsen.blog

LabVIEW Example

Hans-Petter Halvorsen
12
13
14
Hans-Petter Halvorsen
University of South-Eastern Norway
www.usn.no

E-mail: [email protected]
Web: https://www.halvorsen.blog

You might also like