0% found this document useful (0 votes)
72 views

LabVIEW Course

Here are the steps to solve this problem: 1. Create controls for inputs a, b, c (integer type) 2. Create indicators for outputs x1, x2, x3 (integer type) 3. On the block diagram: - Use "If" structure to check if a>b and a>c - If true, assign a to x1 - Else use "If" structure to check if b>c - If true, assign b to x1 - Else assign c to x1 4. Repeat step 3 to assign values to x2 and x3 5. Run test cases to verify outputs The block diagram would contain "If" structures nested

Uploaded by

maryam ebrahimi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

LabVIEW Course

Here are the steps to solve this problem: 1. Create controls for inputs a, b, c (integer type) 2. Create indicators for outputs x1, x2, x3 (integer type) 3. On the block diagram: - Use "If" structure to check if a>b and a>c - If true, assign a to x1 - Else use "If" structure to check if b>c - If true, assign b to x1 - Else assign c to x1 4. Repeat step 3 to assign values to x2 and x3 5. Run test cases to verify outputs The block diagram would contain "If" structures nested

Uploaded by

maryam ebrahimi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

LabVIEW

Dept. of Mechanical and Industrial


Engineering
University of Toronto
11-06-2019
Lesson 1
Navigating LabVIEW
1.What is LabVIEW
2.Project Explorer
3.Parts of a VI
4.Front Panel
5.Block Diagram
6.Searching for Controls, VIs and Functions
7.Selecting a Tool
8.Dataflow
9.Building a Simple VI
Lesson 1
Navigating LabView
1.What is LabVIEW
2.Project Explorer
3.Parts of a VI
4.Front Panel
5.Block Diagram
6.Searching for Controls, Vis and Functions
7.Selecting a Tool
8.Dataflow
9.Building a Simple VI
1.What is LabVIEW

LabVIEW is a graphical programming environment designed


to accelerate the productivity of scientists and
engineers.

With a graphical programming syntax that makes it simple


to visualize, create, and code engineering systems.

LabVIEW is used to translate ideas into reality, reduce test


times, and determine results based on collected data.
LabVIEW for Instrument Control

RS-232 Standard Serial Port

GPIB (General Purpose Interface Bus)


LabVIEW for Instrument Control

GPIB (General Purpose Interface Bus)

RS-232 Standard Serial Port


USB
Ethernet
• LabVIEW programs imitate the appearance and operation of physical
instruments, such as oscilloscopes and multi meters. LabVIEW programs
are called virtual instruments or, more commonly, VIs.

• VIs have front panels and block diagrams.

• The front panel is the user interface.

• The block diagram is the programming behind the user interface.

• After you build the front panel, you add code using graphical
representations of functions to control the front panel objects.

• The code on the block diagram is graphical code, also known as G code or
block diagram code.
Launching the LabVIEW Environment: When you launch LabVIEW, the Getting
Started window appears as shown in Figure1-1.

Figure 1-1. LabVIEW Getting Started Window


Front Panel
Block Diagram
Front Panel
Controls and Indicators:

• You create the front panel with controls and indicators, which are the interactive
input and output terminals of the VI, respectively.

• Controls are knobs, push buttons, dials, and other input devices.

• Indicators are graphs, LEDs and other displays.

• Controls simulate instrument input devices and supply data to the block diagram
of the VI.

• Indicators simulate instrument output devices and display data the block
diagram acquires or generates.
Numeric Controls and Indicators:

The numeric data type can represent numbers of various types,


such as integer or real.

Boolean Controls and Indicators:


The Boolean data type represents data that only has two possible states,
such as TRUE and FALSE or ON and OFF.
String Controls and Indicators:

The string data type is a sequence of ASCII characters.


Use string controls to receive text from the user such as a password or user
name. Use string indicators to display text to the user.
Controls Palette:

The Controls palette contains the controls and


indicators you use to create the front panel.
Front Panel Window Toolbar

Click the Run button to run a VI.


Click the Run Continuously button to run the VI until you abort or
pause execution.

While the VI runs, the Abort Execution button appears. Click this
button to stop the VI immediately if there is no other way to stop
the VI.
Click the Pause button to pause a running VI.
Block Diagram

Block diagram objects include terminals, subVIs, functions, constants,


structures, and wires, which transfer data among other block diagram
objects.

1 Indicator Terminals 2 Wires 3 Nodes 4 Control Terminals


Controls, Indicators, and Constants:

Controls, indicators, and constants behave as inputs and outputs of the block
diagram algorithm.
Consider the implementation of the algorithm for the area of a triangle:

Area = 1/2 * Base * Height In this algorithm, Base (cm) and Height (cm) are
inputs and Area (cm^2) is an output, as shown in Figure1-13.

Block Diagram
Block Diagram 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.


SubVIs

SubVIs are VIs that you create to use inside of another VI or that you
access on the Functions palette.
Omega Temp sub vi in Temperature history vi
Wires:

We transfer data among block diagram objects through wires.

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,
as shown below. Broken wires occur for a variety of reasons, such as
when you try to wire two objects with incompatible data types.
Functions Palette
The Functions palette contains the VIs, functions and constants we use to
create the block diagram.
We access the Functions palette from the block diagram by selecting View »
Functions Palette.
Block Diagram Toolbar
When you run a VI, buttons appear on the block diagram toolbar that you
can use to debug the VI.

The following toolbar appears on the block diagram.

Highlight Execution
Clean Up Diagram
Run
LabVIEW Help Utilities
Use the Context Help window, the LabVIEW Help, and the NI
Example Finder to help you create and edit VIs.
Dataflow

• LabVIEW follows a dataflow model for running VIs.


• A block diagram node executes when it receives all required inputs.
• When a node executes, it produces output data and passes the data to the next
node in the dataflow path.
• The movement of data through the nodes determines the execution order of
the VIs and functions on the block diagram.

Figure1-31. In this case, the block diagram executes from left to right

A B C
A

In Figure1-32, consider which code segment would execute first—the Add,


Random Number, or Divide function.

You cannot know because inputs to the Add and Divide functions are available
at the same time, and the Random Number function has no inputs.

In a situation where one code segment must execute before another, and no
data dependency exists between the functions, use other programming
methods, such as error clusters, to force the order of execution.
Building a Simple VI
Most LabVIEW VIs have three main tasks—acquiring some sort of data,
analyzing the acquired data, and presenting the result.
1. Which function executes first: Add or Subtract?
a. Add b. Subtract c. Unknown

2. Which function executes first: Sine or Divide?


a. Sine b. Divide c. Unknown

3. Which function executes first: Random Number, Divide or Add?


a. Random Number b. Divide c. Add d. Unknown
4. Which function executes last: Random Number, Subtract or Add?
a. Random Number b. Subtract c. Add d. Unknown

5. What are the three parts of a VI?


a. Front panel window
b. Block diagram window
c. Project
d. Icon/connector pane
Assignment 1: Question 1

Question # 1

Write a program to calculate a triangle’s area “A”. (Triangle sides a, b, c >0)

Test your code to compute the area “A” with following input parameters.
a= 3, b=5 and c=7.

Front Panel
Question # 2 Assignment 1: Question 2

Write a program to calculate each output x1,x2 and x3.


Input parameters a, b and c are integers.
Front Panel

Block Diagram

You might also like