NI LabView first day of learning

Source: Internet
Author: User

Reference site: http://www.ni.com/getting-started/labview-basics/zhs/environment

Introduction to LabVIEW development environment

Welcome to use labview! This guide will help you quickly master some of the basic concepts of LabVIEW and graphical programming.

LabVIEW program, also known as virtual instruments, or VI, its appearance and operation are simulated real physical instruments, such as oscilloscopes and multimeter. LabVIEW has a complete set of tools for capturing, analyzing, displaying, and storing data, as well as a comprehensive set of debugging tools to solve the problems users are experiencing in writing their code.

After creating a VI, you will see two windows: The Front panel window and the program block diagram.

Front panel

When you open a new vi or existing VI, the Front panel window of VI is displayed. The Front panel window is the user interface of VI. Figure 1 is an example of a front panel window.

(1) Front window |  (2) Toolbar | (3) Control palette

Figure 1. Front Panel Example

Control palette

The control palette contains input controls and display controls for creating the front panel. In the Front panel window, click View» Control Palette, or right-click an empty space to open the control palette. The control palette contains a variety of controls that you can select to display all or part of the category. In Figure 2 , the Control palette displays all the control categories and expands to show the "modern" (modern) category.

Figure 2. Control palette

To show or hide the category (sub-palette), click the Customize button and select Change visible palette.

Input controls and display controls

Each VI consists of a front panel. It acts as a user interface and can be used as a means of transmitting input and receiving output when the VI is called in other program block diagrams. You can create a user interface by placing the input control and display controls on the VI front panel. When the front panel is used as a user interface interaction, input values can be modified in the input control, and the results are viewed in the display control. That is, the input control determines the input and displays the output of the control display.

Typical input controls are knobs, buttons, dials, sliders, and strings. The input control simulates the physical input device and provides data for the program block diagram of VI. Typical display controls are graphs, charts, LED lights, and status strings. The display control simulates the output device of the physical instrument and displays the data obtained or generated by the program block diagram.

Figure 1 contains 2 display controls: "Number of measurements" and "Delay (sec)", and a display control: "Temperature Graph" xy coordinate chart.

Users can change the input values of the "number of measurements" and "Delay (sec)" Display controls, and then observe the values generated by VI in the temperature Graph display control. The value in the display control is the result of the program block diagram code running.

Each input control and display control has a specific data type. In the example above, the data type of the "Delay (sec)" Horizontal sliding bar extension is numeric. The most commonly used data types are numeric, Boolean, and string.

Numeric input controls and display controls

Numeric types can represent various types of numbers, such as integers and real numbers. Two common numeric object types in LabVIEW are numeric input controls and numeric display controls, as shown in Figure 3 . In addition, the instrument, turntable and other objects can also represent numerical data.

(1) Increment/decrement button |  (2) Numeric input Controls | (3) Numeric display controls

Figure 3. Numeric input controls and display controls

In the value control, click the Increment/decrement button to change the value, double-click the number to enter a new value, and then press <Enter>.

Boolean input controls and display controls

A Boolean type represents data that has only two states: TRUE or false; Boolean input controls and display controls are used to enter and display Boolean values, respectively. Boolean objects can simulate switches, buttons, and LED lights. The vertical rocker switch and the round led in Figure 4 are Boolean objects.

Figure 4. Boolean input controls and display controls

string controls and display controls

The string type is a string of ASCII characters. The string input control is used to receive text from the user, such as a password and a user name. The string display control is used to display text to the user. Common string objects are table and text input boxes, as shown in Figure 5 .

Figure 5. String input controls and display controls

Program Block diagram

The program block Diagram object includes terminal, sub vi, function, constant, structure and wiring. Wiring is used to pass data between program block diagram objects.

(1) Display Control Terminal |  (2) Connect |  (3) Node | (4) Input control terminal

Figure 6. Program block diagram and example of front panel

After creating the front panel, you need to add graphical function code to control the front panel object. The Program block Diagram window contains the graphical source code.

Figure 7. Program Block diagram

End of terminal

The objects on the front panel are shown as terminals in the program block diagram. The terminal is an input-output port for exchanging information between the front panel and the program block diagram. The terminal is similar to the parameters and constants of a text programming language. The terminal type has an input/display control terminal and a node terminal. The input/Display control terminal belongs to the input control and display control on the front panel. The data entered by the user in the front panel control enters the program block diagram (6 A and B) via the input control terminal. The data then enters the add and subtract functions. After the add and subtract operation is finished, the new data value is output. The new data enters the display control terminal and then updates the values in the display controls on the front panel (shown in 6 a+b and A-B).

Input controls, display controls, and constants return to top of page

Input controls, display controls, and constants are used as input and output for the program block diagram algorithm. Take the calculation of the Triangle area algorithm as an example:

Area =0.5 x Bottom x high

In the algorithm in Figure 8 , base (bottom) and height (high) are the inputs, and area is the output.

Figure 8. Calculate the front panel of the Triangle area VI

Because the user does not need to change or access the constant 0.5, it does not appear on the front panel.

Figure 9 is the implementation code of the algorithm on the LabVIEW program block diagram. There are 4 terminals in the program diagram, each generated by 2 input controls, a constant, and a display control.

(1) Input Controls |  (2) Display Controls | (3) Constants

Figure 9. Program block diagram for calculating Triangle area algorithm (terminal shown as icon)

Note that the appearance of base (cm) and height (cm) two terminals in the program block diagram is different from the area (CM2) terminal. There are two notable differences between the input control and the Display control Terminal: First, the data flow arrows on the terminal are different. The direction of the input control arrows shows the data flowing out of the terminal, while the direction of the display control arrows shows the data flowing into the terminal. Second, the terminal border is not the same. The border of the input control is thicker, and the border of the display control is thinner.

The terminal can either be displayed as an icon, or it can be displayed as an icon. Figure Ten is the same program block diagram that is not displayed as an icon, where the distinguishing characteristics of the input control and the display control are the same.

Figure Ten. Program block diagram for calculating Triangle area algorithm (terminal not shown as icon)

Program Block diagram node

A node is an object that has input/output on the program block diagram and performs certain operations on the VI runtime. Nodes are equivalent to statements, operations, functions, and subroutines in a text programming language. A node can be a function, a child VI, an Express VI, or a structure. A structure is a process control element, such as a conditional structure, a for loop, and a while loop.

Function

Functions are the basic operational elements of LabVIEW. In the example in Figure 6 , the "plus" and "minus" functions are function nodes. The function does not have a front panel or Program block Diagram window, but has a connection board. Double-click a function to select only that function. The background of the function icon is light yellow.

Sub VI

A vi is created so that it can be used in other VI, VI called by other VI called Sub VI. Child VI can be called repeatedly. To create a Sub VI, you first create a line board and an icon for the Child VI.

A child vi node is similar to a subroutine call in a text programming language. The node is not the child VI itself, just as the subroutine call instruction in text programming is not the same as the program itself. The same sub-VI appears several times in the program block diagram, indicating that the child VI was called several times.

The control of Child VI receives and returns data from the program block diagram of Caller VI. Double-click the Sub vi in the program block diagram to open the Front panel window of Sub VI. The front panel contains input controls and display controls. The program block diagram contains the lines, icons, functions, sub VI and other LabVIEW objects of Sub VI.

Each vi has an icon in the upper right corner of the front panel and the Program Block Diagram window. is a default VI icon. The icon is a graphical representation of VI. The icon can contain both text and images. If one vi is used as a Sub VI of another VI, the icon helps to identify the VI in the program block diagram. The default icon has a number that indicates the number of new VI open after LabVIEW starts.

As shown, to use a VI as a Sub VI, you must create a wire board for it. A wiring board is a set of terminals that correspond to the controls in VI, similar to a function invocation parameter list in a text programming language. You can access the line board by right-clicking the icon in the upper right corner of the front panel window, but the icon in the upper right corner of the Block Diagram window does not access the line board. The background of the child VI icon is white.

Express VI

The Express VI property is configured through a dialog box, so the required number of connections is minimal. Express VI is used to achieve some routine measurement tasks. For more information about Express VI, see the Express VI theme in LabVIEW Help. On the program block diagram, Express VI is displayed as an expandable node with a blue background.

Function Selection Board

The function palette contains the VI, functions, and constants required to create the program block diagram. Select "View» Function Palette" In the program diagram to open the function palette. The function palette contains many categories that can be displayed or hidden as needed. Figure One is a function palette that contains all categories, where the "Programming" (programming) category expands to display.

figure one. Function Selection Board

To show or hide categories, click the Customize button and select Change visible palette.

Search controls, VI, and functions

After you open a control or function palette through the View» Control palette or view» Function palette, you see two buttons at the top:

Search-Converts the palette to search mode, looking for controls, VI, or functions on the palette based on the input text. When the palette is in search mode, click Back to exit the search mode and return to the selection board.

Customize-Changes the display mode of the current palette, such as showing or hiding the palette's categories, or sorting items on the palette alphabetically in text and tree mode. If you click Options on the shortcut menu, you can open the controls/Functions palette page in the Options dialog box to define the display mode for all the palettes. This button appears only when the Pushpin button in the upper-left corner of the palette is pressed.

You can use the Search button to search for functions or VI before you are familiar with the location of VI and functions. For example, to find the random number function, click the Search button on the Function Palette toolbar and type "random number" in the text box at the top. LabVIEW lists all occurrences that begin with text or contain text. You can then click on the desired search result and drag it into the program block diagram (shown in figure ).

figure. Searching for objects in the function palette

If you double-click a search result, you can highlight its position in the palette.

Quick Placement

In addition to the methods described above, you can find and place vi through the Quick Placement dialog box. To open the Quick Placement dialog box, press the <Ctrl-Shift-Space> key.

Quick placement is especially useful when looking for a specific function and operation. As you type, quick place automatically completes the name entry for the matching function. Double-click the function you want to highlight, and then tap the program block diagram or position on the front panel to place the function.

NI LabView first day of learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.