Introduction: LabVIEW Tips, Tricks and Resources
This instructable is meant to be provide an overview of how to program in LabVIEW. National Instruments already has a lot of documentation on this subject, so I will link to the material I found useful. Along with commenting on the resources I have found, I will also outline a tips and tricks I have picked up. Bear in mind, I am self-taught and pretty new to LabVIEW. My methods may be far from best practices. If there is a simpler/better way of doing something let me know in the comments.
Also, a lot of the information I provide in this instructable may seem redundant since NI already has tutorials on it. Personally I don't always have the patience to get all the way through most tutorials. A lot of times I just want a quick example of how to do 1 specific thing. I become frustrated if I have to dig through an entire video, or document to figure out a particular trick. So my goal here is to provide a broad resource that you can quickly search for examples of specific things. I will also link to the more in-depth tutorials if you prefer learning that way.
NOTE: For this instructable I am assuming that readers have a basic knowledge of programing (i.e loops, data types, functions, if else statements ect)
What is LabVIEW?
If you are unfamiliar with LabVIEW and curious about what it is, check out this blog post. Here is a quick summary of the key points discussed in the post.
- LabVIEW is intended to simplify projects, by providing an easy to use package which hides underlying hardware and software complexities an inexperienced user might get stuck on.
- LabVIEW is designed around a data flow programing model (i.e it uses graphical code, rather than text based code).
- LabVIEW lets you quickly and easily build a GUI for your program.
- The software comes with a lot of very useful add-ons and libraries
Step 1: Parts and Tools List
- LabVIEW installed
- VIMP installed
This instructable assumes you already have installed labVIEW and VIMP. If you have not, follow the directions provided here.
Step 2: Useful Documentation
Linked below are the two primary resources I used to get started. There is a lot of useful information there, but I’ll admit, I didn't have the patience to go through it all. I recommend you get through as much of the material as you can stand, and once you are tired of it, keep a mental note of each section’s general topic. That way when you run into a problem, you will know what to refer to for more information.
This resource is good for getting familiar with the basics, and how to implement common programming constructs in LabVIEW. The guide is primarily text and pictures with some supporting videos.
- Resource 1.2:http://www.ni.com/academic/students/learn-labview/
If you prefer videos, to inanimate text and pictures, this resource would be better for you. It is essentially all the videos from the first resource without the text breaking them up.
NOTE: This source has a couple videos that don’t show up in the first.
- Resource 2:https://www.labviewhacker.com/forums/
For information relating to interfacing LabVIEW with your DIY projects LabVIEW Hacker’s website and forums have tons of information.
Step 3: My Top 5 Most Commonly Used Tricks
1. Show Label
Unsure what a certain block is? Use the show label function to display its name.
2. Properties
Want to configure a block or control? Certain blocks can be configured with the properties tab.
NOTE: Not all blocks can be configured this way.
3. Help Button
Need Help? Believe it or not the help button is actually helpful, unlike in a lot of other software. Help will inform you how blocks were intended to work.
4. Inspect SubVI
Curious about how a block actually functions? Open up the subVI and check out the code used to implement it.
5. Find Examples
Want an example of how to do something in LabVIEW? Check out the extensive built in collection of examples.
Step 4: Keyboard Short Cuts
My three most commonly used short cuts.
1. Ctrl+E
Shows the block diagram, or front panel depending on which you are currently working in.
2. Ctrl+H
Shows help related to a selected block.
3. Ctrl+B
Deletes all broken wires in the diagram. It can save a lot of time so you don’t have to select every broken wire individually to delete it. BE CAREFUL when using this short cut! Ctrl+B deletes ALL broken wires on the screen, even ones you may want to keep.
Here is a full List of other useful short cuts: http://www.ni.com/pdf/manuals/373353c.pdf
Step 5: Useful Concepts
Here are some concept’s unique to LabVIEW that I thought you should be aware of.
Shift Registers
Description: Lets you pass data from one loop iteration to the next iteration.
Link:http://www.ni.com/getting-started/labview-basics/...
Tunnels
Description: Tunnels let you pass data in and out of programing structures, like loops and conditional statements.
Link:http://www.ni.com/white-paper/7588/en/ (Go to the middle of page in the link)
Auto-Indexing
Description: Automatically index an array going into, or out of, a loop.
Link:http://digital.ni.com/public.nsf/allkb/B850252338...
Clusters
Description: Clusters let you bundle, or unbundle groups of wires to make your code cleaner and simpler.
Link:http://www.ni.com/white-paper/7571/en/ (Go to the middle of page in the link)
Creating a subVI
Description: Organize your code, by breaking it into smaller VI's that can be reused.
Link1: http://www.ni.com/white-paper/7593/en/
Link2: https://www.youtube.com/watch?v=zr2qqv1F4kk
SubVI Reentrancy
Description: The type of reentrancy applied to the subVI, controls how it is called by other Vis.
Link:https://www.youtube.com/watch?v=MJMDNtJd7lQ
Feed Back Node
Description: Stores data from one VI execution or loop iteration to the next.
Step 6: Useful Blocks
Here is a quick list of blocks that I thought were worth mentioning.
Diagram Disable Structure
Lets you disable (comment out) sections of code.
Formula Node
Lets you type out formulas rather than building them with blocks.
First Call?
Returns True, if it is the first time this block has been called inside a loop.
Property Node
All the blocks, and controls in LabVIEW are built using object oriented programming. If you want to manipulate the object properties of a particular block, the Property Node is your solution. For example lets say we want to change how many indices of an array display on the front panel during runtime. This is how the property node gives us the power to do that.
Step 7: Other Quick Tips and Tricks
Front Panel Pallet VS Block
Diagram PalletConfused that a pallet is missing some blocks? Remember that the Front Panel Pallets and Block diagram Pallets are different.
Find a lost block/indicator
Having a hard time finding the corresponding block of an indicator? Find it this way!
Draw Wires Around things
Frustrated with the LabVIEW auto routing wires behind blocks and over other wires? Draw your wires around obstacles by clicking where you want the wire to go!
Setting Default Values
Do you want set a control to always start at a default value? Here is how to set the default!
Comment out Code
You want to temporarily remove broken test code? Heres how!
Change to Indicator
Want to make a a block accept input data, rather than output it? Use the change Indicator feature!
How to make a 2D Array
Want to make an array 2x2 array to store values? Heres how!
Math on elements in an array
Do you need to do some math to every value contained in an array? LabVIEW makes it easy!
Replace Block
Need to replace a block with another without deleting the wires? See how here!
Type out formulas
Want to type out a formula instead of building it with blocks? Use the Formula node!
View as Icon
Is your code cluttered by lots of icons? Make them smaller with the view icon function!
Auto Clean Code
Is your block diagram getting messy? Let LabVIEW automatically respace and organize your code!
Align Blocks
Want to perfectly align blocks to better organize your code? Use the alignment tools!
Auto Space Blocks
Want to perfectly space out your blocks? Use the auto space feature!
Pallet Search Function
Trying to remember what sub pallet a block is located in? Use the pallet search function to find it!
Comment your code
Want to leave some comments in your code to explain what is going on? Use the decorations pallet to describe your code!
Detailed Descriptions
Is your code to cluttered to add more labels describing it? Use the description and tip function to leave hidden explanations of your code!
Step 8: My Final Recommendations
Use Google
This is my number 1 answer whenever anyone asks me how to do anything. Searching for information with google is how I answer 95% of my questions. Typically forums, and documentation on the subject are the most useful resources.
Experiment
Sometimes google can’t give you all the answers. If I can’t find an answer on a forum or in some documentation I turn to experimentation. Using information I have found on google I make educated guesses about problems and test them. I keep making educated guesses and testing until I get the desired results or I am completely stumped. If I am stumped I look for new information using google to try to clarify the problem further.
If you want to really understand how something works experimentation is the way to go. You can only learn so much about something from reading.
That pretty much sums everything up. I hope that between the NI’s documentation and my tips and tricks, you can easily become familiar with LabVIEW.