Download presentation
Presentation is loading. Please wait.
Published byHenry Pierce O’Brien’ Modified over 9 years ago
1
Advanced LabVIEW Topics Dustin Cruise
2
Who is this guy? Graduate Student in Mechanical Engineering at Purdue University Specialty Areas: Combustion Control Systems I work in a lab burning things and using lasers I use LabVIEW a lot in my research Sensors Actuators Data Acquisition and Analysis Image Capture and Machine Vision
3
Topics Today Advanced Code Structures – State Machines – Multiple/Parallel Loops Passing Data – Queues – Notifiers – Local Variables Resources
4
Everything in One Giant Loop Can’t run at different rates. Not all tasks need to be run every loop execution – Some may only run when there is an user input, or hardware trigger Split tasks into multiple loops
5
Standard Design Patterns for Splitting Tasks State Machines Parallel Loops – Master/Slave – Producer/Consumer – User Interface Event Handler
6
STATE MACHINES
7
State Machine Basics “States” are events independent from another – Start, Stop – Start Drive Fwd Turn Left Move Arm Move Arm Stop State Machine consists of a While Loop, Case Structure, Shift Register, and Transition Code – Each case defines a “state” of the machine – At end of current state, decide next state to go to; stay or go to different state
8
State Diagram
9
State Machine Example Case Structure States Transitions Event driven
10
PARALLEL LOOPS
11
Parallel Loops Multiple or Parallel Loops for multiple tasks where timing is important – Each loop has their own bit of processor – One loop can have higher priority for processor over another – Loops can run at different rates Will need to pass data between loops
12
Master/Slave One as Master, others as slaves. Master controls all the slave loops. Slaves must take less time than Master so data is not lost Good for: – Responding to user interface while also collecting data
13
Master/Slave Example Data passed with shared variable in this case
14
Producer / Consumer Separates tasks between: – Tasks producing data – Tasks consuming data Uses queues to pass data Good example of use:
15
Producer/Consumer Example Data passed with shared variable in this case
16
Queues, Notifiers, and Variable Queues when wanting all data Notifiers when only most current data – Don’t buffer data, so overwriting is an issue Variables – Local Available to all of VI – Global Available to all Vis – Shared
17
Diagnosing problems Probes Execution Highlighting PLOT PLOT PLOT PLOT PLOT PLOT – CHARTS ARE THE BEST! – KEY ADVANTAGE OF LABVIEW!
18
How to learn LabVIEW The secret to learning LabVIEW… is doing LabVIEW. Build a library of examples as you come across them – Most likely, what you’re trying to do has already been done before – Try to explain what each piece of an example VI does. It doesn’t work to just glance over Get familiar with resources
19
Resources FIRST’s getting started documentation that comes with the control system (available online as well) – Search for FRC LabVIEW NI and lots of things come up. FRCmastery.com NI Examples found in Help menu NI.com Effective LabVIEW Programming, Thomas J. Bress
20
Examples State machine – Help, State Machine fundamentals Master Slave Producer consumer Queues, Local Variables – Disc 2, Queues vs Local Variables – Help, Simple Queues Notifiers – Help, Simple Notifiers
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.