NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Currently Being Moderated

Tutorial & Video: Introduction to the NI LabVIEW Environment

VERSION 3

Created on: May 27, 2008 11:06 AM by NI FIRST - Last Modified:  May 30, 2008 2:42 PM by NI FIRST

 

 

NI LabVIEW is a graphical development environment that features the performance and flexibility of a traditional programming language. In fact, the full-featured LabVIEW development environment has the same constructs that traditional languages have – variables, data types, objects, looping, and sequencing structures as well as error handling.

 

You can use LabVIEW to communicate with hardware such as cameras, motion control devices, joysticks, and so on. LabVIEW includes many tools for acquiring data, processing or analyzing input data, and then storing the data to a file. It not only contains all these useful tools but also provides options for troubleshooting your code easily and efficiently.

 

LabVIEW programs are called virtual instruments, or VIs, because their appearance and operation imitate physical instruments, such as oscilloscopes and multimeters. Each LabVIEW VI contains two main components – the front panel and the block diagram, which this tutorial explores later.

 

Getting Started Window

Launch LabVIEW by going to the Start Menu >> All Programs >> National Instruments LabVIEW 8.5.

 

When you launch LabVIEW, the Getting Started window appears.

 

Use this window to create new VIs, choose among the most recently opened LabVIEW files, find examples, and launch LabVIEW Help. You also can access information and resources to help you learn about LabVIEW, such as specific manuals, help topics, and resources, on the NI Web site.

 

Note: The Getting Started window disappears when you open a file or create a new file. You can display it by selecting View >> Getting Started Window. The window appears when you close all open front panels and block diagrams.

 

The Getting Started window gives you easy access to many features, including the following.

 

The New section lists new LabVIEW file types that you can launch from the Getting Started window. Click this link to open the New dialog box for more options.

 

  • Blank VI – Creates a new, blank virtual instrument (VI).

  • Empty Project – Creates an empty LabVIEW Project.

 

The Open section opens the file dialog box so you can open an existing LabVIEW file.

 

  • Most Recently Used Files – Opens the file you select.

  • Browse – Opens the file dialog box so you can open an existing LabVIEW file. (Windows)

 

The Target section specifies the target for which you want to create a project.

 

Note: This pull-down menu appears only if you have the LabVIEW Real-Time, LabVIEW FPGA, LabVIEW PDA, LabVIEW Touch Panel, or LabVIEW DSP modules installed.

 

The Resources section provides getting-started documents, information on new LabVIEW features, and instructions on finding premade examples.

 

 

 

The New To LabVIEW? section displays the Getting Started with LabVIEW manual. Use this manual to familiarize yourself with the LabVIEW graphical programming environment and basic LabVIEW features.

 

The following link Additional NI LabVIEW Resources has even more documents to use when getting started. 

 

The Upgrading LabVIEW? section includes a list of new features in the latest version of LabVIEW.

 

 

 

  • LabVIEW Project Enhancements

  • Merging VIs

  • Adding a Conditional Terminal to a For Loop

  • List of All New Features

 

The Web Resources section opens LabVIEW Zone in a Web browser.

 

LabVIEW Zone is a central location for videos, documents, and other resources on LabVIEW. You can view videos of applications that incorporate LabVIEW, including robotic applications, and read the LabVIEW tip of the week. In addition to helpful technical documents, LabVIEW Zone features LabVIEW social networks such as Facebook, YouTube, and many blogs.

 

 

 

  • Discussion Forums – Opens the LabVIEW discussion forums in a Web browser.

  • Training Courses – Displays information about LabVIEW hands-on courses in a Web browser.

  • LabVIEW Zone – Opens LabVIEW Zone in a Web browser.

 

Remember you can always go to FIRST Community to post questions and find FIRST documents.

 

The Examples section launches NI Example Finder so you can locate the example VIs and projects you need. These examples range from basic LabVIEW concepts and instructions for using while loops to advanced topics such as file input/output.

 

  • Find Examples – Launches NI Example Finder so you can find example VIs and projects.

 

You also can launch NI Example Finder by selecting Help >> Find. LabVIEW provides many shipping examples to get you started. You can modify an example VI to fit an application, or you can copy and paste from one or more examples into a VI that you create.

 

Use the Browse or Search page of the NI Example Finder to find an example VI. Use the NI Example Finder to search or browse for VI-based or project-based examples for LabVIEW. When you open a project-based example, the LabVIEW Project file (.lvproj) opens in the Project Explorer window. Double-click the VI under My Computer in the Project Explorer window to open the example.

 

Note: You also can right-click a VI or function on the block diagram or on a pinned palette and select Examples from the shortcut menu to open a help topic with links to examples for that VI or function.

 

Note: You can access all of the same functions through the Menu bar, for example File >> Exit.

 

Creating and Saving a VI

When you click the New button in the LabVIEW dialog box, the New dialog box appears. You also can select File >> New to display this dialog box. When you select a template in the Create New list, previews of the VI appear in the Front Panel Preview and the Block Diagram Preview sections, and a description of the template appears in the Description section.

Click the OK button to open the template. You also can double-click the name of the template VI in the Create New list to open the template. If no template is available for the task you want to create, you can start with a blank VI and create a VI to accomplish the specific task.

 

You also can open a blank VI by selecting Blank VI from the Create New list in the New dialog box or by selecting File >> New VI.

 

Opening an Existing VI

 

Load a VI into memory by selecting File >> Open. In the Choose the VI to Open dialog box that appears, navigate to the VI you want to open.

 

As the VI loads, a status dialog box similar to the picture below might appear.

 

The Loading section lists the subVIs of the VI as they are loaded into memory. Number Loaded is the number of subVIs loaded into memory so far. You can cancel the load at any time by clicking the Stop button.

 

If LabVIEW cannot immediately locate a subVI, it begins searching through all directories specified by the VI Search Path. You can edit the VI Search Path by selecting Tools >> Options and selecting Paths from the top pull-down menu. The Searching section lists directories or VIs as LabVIEW searches through them. You can direct LabVIEW to ignore a subVI by clicking the Ignore SubVI button, or you can click the Browse button to search for the missing subVI.

 

Saving VIs

 

Select Save, Save As, or Save All from the File menu to save VIs as individual files or group several VIs together and save them in a VI library. VI library files end with the extension .llb. National Instruments recommends that you save VIs as individual files, organized in directories, especially if multiple members of the team are working on the same project. LabVIEW uses the native file dialog boxes so they act similar to other applications on the computer.

 

Project Explorer Window

Use projects to group together LabVIEW and other files and deploy or download files to targets. When you save a project, LabVIEW creates a project file (.lvproj), which includes references to files in the project, configuration information, build information, deployment information, and so on.

 

Use the Project Explorer window to create and edit LabVIEW projects. Select File >> New Project to display the Project Explorer window.

 

If you are currently working on a VI and choose to create a New Project, you can easily add the current VI to it. The following screen appears, and you can decide to automatically add the VI(s) that you are working on to the new project.

 

Once you select Add or Don’t Add, the Project Explorer window opens.

 

You also can select Project >> New Project or select Empty Project in the New dialog box to display the Project Explorer window.

 

The Project Explorer window includes two pages, the Items page and the Files page. The Items page displays the project items as they exist in the project tree. The Files page displays the project items that have a corresponding file on disk. You can organize filenames and folders on this page. Project operations on the Files page both reflect and update the contents on disk. You can switch from one page to the other by right-clicking a folder or item under a target and selecting Show in Items View or Show in Files View from the shortcut menu.

 

The Project Explorer window includes the following items by default:

 

  • Project root – Contains all other items in the Project Explorer window. This label on the project root includes the filename for the project.

  • My Computer – Represents the local computer as a target in the project. Dependencies – Includes items that VIs under a target require.

  • Build Specifications – Includes build configurations for source distributions and other types of builds available in LabVIEW toolkits and modules. If you have the LabVIEW Professional Development System or LabVIEW Application Builder installed, you can use Build Specifications to configure stand-alone applications, shared libraries, installers, and zip files.

 

You can place a VI from the Project Explorer window on the block diagram of another open VI. Select the VI you want to use as a subVI from the Project Explorer window and drag it to the block diagram of the other VI.

 

To learn more about the Project Explorer Window, check out the LabVIEW help, which you can find from within LabVIEW at Help >> Search the LabVIEW Help

 

 

 

Front Panel and Block Diagram

In LabVIEW, you build a user interface, or front panel, with controls and indicators. Controls are knobs, push buttons, dials, and other input devices. Indicators are graphs, LEDs, and other displays. After you build the user interface, you add code using VIs and structures to control the front panel objects. The block diagram contains this code.

 

 

To learn even more about these different topics, reference the following video:

 

 

After you build the front panel, you add code using graphical representations of functions to control the front panel objects. The block diagram contains this graphical source code. Front panel objects appear as terminals on the block diagram. Block diagram objects include terminals, subVIs, functions, constants, structures, and wires, which transfer data among other block diagram objects.

 

 

 

Functions

 

Functions are the fundamental operating elements of LabVIEW. Functions do not have front panels or block diagrams but do have connector panes. Double-clicking a function only selects the function.

 

Nodes

 

Nodes are objects on the block diagram that have inputs and/or outputs and perform operations when a VI runs. They are analogous to statements, operators, functions, and subroutines in text-based programming languages. Nodes can be functions, subVIs, or structures. Structures are process control elements, such as case structures, for loops, or while loops. The Add and Subtract functions are function nodes.

 

Terminals

 

Front panel objects appear as terminals on the block diagram. The terminals represent the data type of the control or indicator. You can configure front panel controls or indicators to appear as icon or data type terminals on the block diagram. By default, front panel objects appear as icon terminals. For example, a knob icon terminal represents a knob on the front panel. To display a terminal as a data type on the block diagram, right-click the terminal and select View As Icon from the shortcut menu to remove the checkmark.

 

Wires

 

You transfer data among block diagram objects through wires. Wires are analogous to variables in text-based programming languages. Each wire has a single data source, but you can wire it to many VIs and functions that read the data. Wires are different colors, styles, and thicknesses, depending on their data types. A broken wire appears as a dashed black line with a red X in the middle. The examples in the following table are the most common wire types.

 

In LabVIEW, you use wires to connect multiple terminals together to pass data in a VI. The wires must be connected to inputs and outputs that are compatible with the data that is transferred with the wire. For example, you cannot wire an array output to a numeric input. In addition the direction of the wires must be correct. The wires must be connected to only one input and at least one output – you cannot wire two indicators together. The components that determine wiring compatibility include the data type of the control and/or indicator and the data type of the terminal.

 

Average User Rating
(0 ratings)




There are no comments on this document

More Like This

  • Retrieving data ...