Top Banner
LabVIEW State Machine Hans-Petter Halvorsen https://www.halvorsen.blog Creating LabVIEW Applications using the State Machine Principles
15

LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

Mar 18, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

LabVIEW State Machine

Hans-Petter Halvorsen

https://www.halvorsen.blog

Creating LabVIEW Applications using the State Machine Principles

Page 2: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

LabVIEW• LabVIEW is a graphical programming language• LabVIEW has powerful features for Simulation,

Control, Vision and DAQ ApplicationsResources:• https://halvorsen.blog/documents/programming/labview/• https://halvorsen.blog/documents/teaching/courses/labview_automation.php

2

Page 3: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

Basic LabVIEW Example

3

While Loop

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

Page 4: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

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

Page 5: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

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

Page 6: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

6

Page 7: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

State Machine Example

7

Shift Register

While Loop Case Structure

Event Structure

Page 8: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

Structure your Code!

• Use the State Machine principles• Use the Project Explorer• Create and use SubVIs

8

Page 9: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

Project Explorer

9

Page 10: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

SubVIs

10

Page 11: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

LabVIEW Example

Hans-Petter Halvorsen

https://www.halvorsen.blog

Page 12: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

12

Page 13: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

13

Page 14: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

14

Page 15: LabVIEW State Machine - halvorsen.blog · LabVIEW developers frequently use to build applications In LabVIEW software, you can create a basic state machine with a While loop, a Shift

Hans-Petter Halvorsen

University of South-Eastern Norwaywww.usn.no

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