0% found this document useful (0 votes)
24 views60 pages

LabVIEW - Introduction

This document provides an introduction to LabVIEW, focusing on virtual instruments (VIs), the LabVIEW environment, and help options. It covers the graphical programming system, the structure of VIs including front panels and block diagrams, and the various controls and indicators used in LabVIEW. Additionally, it discusses dataflow programming, debugging techniques, and offers tips for working efficiently within the LabVIEW platform.

Uploaded by

sorac70536
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views60 pages

LabVIEW - Introduction

This document provides an introduction to LabVIEW, focusing on virtual instruments (VIs), the LabVIEW environment, and help options. It covers the graphical programming system, the structure of VIs including front panels and block diagrams, and the various controls and indicators used in LabVIEW. Additionally, it discusses dataflow programming, debugging techniques, and offers tips for working efficiently within the LabVIEW platform.

Uploaded by

sorac70536
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 60

Week 2

Introduction to LabVIEW

You Will Learn:

A. What a virtual instrument (VI) is


B. The LabVIEW environment
C. LabVIEW Help Options

工程量測與虛擬儀表設計 SNAME, NCKU 1


The Virtual Instrumentation Approach

工程量測與虛擬儀表設計 SNAME, NCKU 2


Virtual Instrumentation Applications
• Design
– Signal and image processing
– Embedded system programming
• (PC, DSP, FPGA, microcontroller)
– Simulation and Prototyping
– And more …
• Control
– Automatic controls and dynamic systems
– Mechatronics and robotics
– And more … A single graphical development platform
• Measurements
– Circuits and electronics
Design Prototype Deploy
– Measurements and instrumentation
– And more …

工程量測與虛擬儀表設計 SNAME, NCKU 3


LabVIEW Graphical Development System

• Graphical programming environment


• Compile code for multiple OS and devices
• Useful in a broad range of applications

工程量測與虛擬儀表設計 SNAME, NCKU 4


What Is LabVIEW?
— 圖型化的程式開發環境,用來開發,量測,測試及控制相關程式

LabVIEW:
• 與各式各樣的硬體溝通
• 在不同的硬體與作業系統執行
• 內建擷取,分析,呈現的函式

Starting a VI Getting Started

開啟舊的 VI/ 專案

建立新的 VI/ 專案

近期開啟的檔案

6
Project Explorer
開發大型程式或專案
管理多個 VI 及 subVI ,將
LabVIEW 與 non-
LabVIEW 檔案包在一起
Compile to EXE, DLL,
Installer
Deploy to PDA,
FPGA, RT system
程式較大或需要有規劃的整理,就會需
要用到專案來管理

7
VI :構造
人機介面 (Front Panel)
程式方塊圖 (Block Diagram)
圖示 / 連接器面板 (Icon/Connector Pane)

8
LabVIEW Programs Are Called Virtual Instruments
(VIs)
Each VI has 2 windows

Front Panel
• User interface (UI)
– Controls = inputs
– Indicators = outputs

Block Diagram
• Graphical code
– Data travels on wires from controls
through functions to indicators
– Blocks execute by data flow

工程量測與虛擬儀表設計 SNAME, NCKU 9


Controls Palette
(Place items on the front panel window)

Control:
Numeric
Customize
Palette View

Indicator:
Numeric Slide

工程量測與虛擬儀表設計 SNAME, NCKU 10


Front Panel :
Front Panel Toolbar & Controls Palette
控制面版

View » Controls Palette



空白處按右鍵

11
Controls and Indicators
Controls Indicators
Input devices Output devices
Knobs, buttons, Graphs, LEDs
slides Display data the
Supply data to the block diagram
block diagram acquires or
generates
Front Panel : Controls & Indicators
Boolean
Numeric

String

13
Numeric Controls and Indicators
The numeric data in a control or indicator can
represent numbers of various types, such as
integer or floating-point.( 數值可為整數或浮點數 )

Numeric control
數值控制
Increment/Decrement buttons
增減按紐

Numeric indicator
數值顯示
Boolean Controls and Indicators
布林資料型態僅只有兩種,如 True/False 或 On/Off.
使用布林元件輸入或顯示布林資料 (TRUE/FALSE).
布林元件就像開關 (switches), 按鈕 (push buttons), 燈號
LEDs.

Boolean Boolean
control indicator
Strings( 字串 )
字串資料類型為一串 ASCII 字元 .
使用字串控制元件接收使用者輸入文字,如名字或密碼等 .
使用字串顯示元件顯示文字給使用者 .
VI : Front Panel
人機介面 ( 使用者介面 )
 Control (Input)
 Indicator (Output)
Control Indicator

17
Front Panel
執行與停止 字型設定 物件對齊工具 尋找
Front Panel Object Styles
Controls Palette
Contains the
controls and
indicators you use
to create the front
panel.
Navigate the
subpalettes or use
the Search button
to search the
Controls palette. 空白處按右鍵
Front Panel :
Shortcut Menus & Property Dialog Box
物件上按右鍵

修改物件來修改屬性
21
練習 1 :熟悉如何建立 Front Panel

22
工程量測與虛擬儀表設計 SNAME, NCKU 23
Block Diagram :
Front Panel Toolbar & Functions Palette
函數面版

除錯工具

24
Functions (and Structures) Palette
(Place items on the block diagram Window)

Structure:
While Loop

工程量測與虛擬儀表設計 SNAME, NCKU 25


Block Diagram
執行與停止 整線工具
Functions Palette
Contains the VIs,
functions, and
constants you use to
create the block
diagram.
Navigate the
subpalettes or use
the Search button to
search the Functions
palette. 空白處按右鍵
Block Diagram
程式方塊圖 ( 圖形化程式語言 )
Terminal( 接點 )
 Control & Indicator
Constant( 常數 )
Node( 節點 )
 SubVI( 副程式 )
indicator
 Function( 函數 )
control
 Structure( 結構 )
Wire( 接線 )
Context Help

28
Terminals

Same label name


練習 2 :梯形面積計算
公式: ( 上底+下底 ) × 高 ÷ 2 = 梯形面積

30
Block Diagram :術語
Terminal( 接點 )
Constant( 常數 )
Node( 節點 )
Function( 函式 )
SubVI( 副程式 )
Structure( 結構 )
Wire( 接線 )
Tips
<Ctrl> + E Front Panel 及 Block Diagram 中切換

31
Nodes
Nodes are objects on the block diagram that have
inputs and/or outputs and perform operations when
a VI runs.

Nodes
Function Nodes
Functions are:
Fundamental operating elements of LabVIEW.
Do not have front panels or block diagrams,
but do have connector panes.
Has a pale yellow ( 淺黃色 ) background on its
icon.
Double-clicking a function only selects the
function.
Functions do not open like VIs and subVIs.( 最底層 )
Block Diagram : SubVI( 副程式 )
SubVI Node
具有 Front Panel 與 Block Diagram
Icon & Connector Pane
內建 & 自創
Express VIs
功能較強大的內建 VI
對話框

34
Wires
Wires transfer data between block diagram
objects. 接線傳送物件間的資料
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.
Floating-point Integer String Boolean

Scalar
1-D Array
2-D Array
Wires
Data Types Found in LabVIEW

工程量測與虛擬儀表設計 SNAME, NCKU 37


Dataflow Programming
• Block diagram execution
– Dependent on the flow of data
– Block diagram does NOT execute
left to right
• Node executes when data is available to
ALL input terminals
• Nodes supply data to all output terminals
when done

工程量測與虛擬儀表設計 SNAME, NCKU 38


Debugging Techniques
• Finding Errors

Click on broken Run button.


• Execution Highlighting Window showing error appears.

Click on Execution Highlighting button; data flow is


• Probes animated using bubbles. Values are
displayed on wires.

Right-click on wire to display probe; it shows data as


it flows through wire segment.

You can also select Probe tool from Tools palette and
click on wire.

工程量測與虛擬儀表設計 SNAME, NCKU 39


練習 3 :建立程式區

40
Block Diagram :
Tips on Nodes & Movement
Create Control/Indicator/Constant

Replace
複製 <Ctrl+ 拖曳物件 >
物件依單軸方向移動 <Shift+ 拖曳物件 >

41
VI : Icon/Connector Pane
將 VI 使用為 subVI 時
Icon: VI 的圖示代表
Connector Pane: VI 的輸入與輸出

42
Block Diagram : Wire (cont.)
自動型別轉換

斷線

Tips
<Ctrl>+B 自動移除斷線
<Ctrl>+R 執行
<Ctrl>+ . 停止

43
工程量測與虛擬儀表設計 SNAME, NCKU 44
Front Panel or Block Diagram View\Tools
Palette
指定滑鼠游標的操作
工具面版

自動選項工具

操作工具 標籤工具

定位工具 彈出工具

接線工具 捲軸工具

斷點工具 取色工具

著色工具 探針工具

45
Status Toolbar

Run Button

Continuous Run Button

Abort Execution

Additional Buttons on the Diagram Toolbar

Execution Highlighting Button


Retain Wire Values Button
Step Function Buttons

工程量測與虛擬儀表設計 SNAME, NCKU 47


Context Help Window
• Help»Show Context Help, press the <Ctrl+H> keys
• Hover cursor over object to update window

Additional Help
– Right-click on the VI icon and choose
Help, or
– Choose “Detailed help” on the context
help window

工程量測與虛擬儀表設計 SNAME, NCKU 48


Tips for Working in LabVIEW

• Keystroke Shortcuts
– <Ctrl+H> – Activate/Deactivate Context Help Window
– <Ctrl+B> – Remove Broken Wires from Block Diagram
– <Ctrl+E> – Toggle between Front Panel and Block
Diagram
– <Ctrl+Z> – Undo (also in Edit menu)
• Tools»Options… – Set Preferences in LabVIEW
• File»VI Properties – Configure VI Appearance,
Documentation, and so on

工程量測與虛擬儀表設計 SNAME, NCKU 49


Homework
• Install LabVIEW
• Find a VI example from the LabVIEW and
explain the purpose of the program

工程量測與虛擬儀表設計 SNAME, NCKU 50


Examples
LabVIEW includes
hundreds of example
VIs.
Use NI Example Finder
to browse and search
installed examples.
Select Help»Find
Examples in the menu.
• Click the example buttons in LabVIEW Help topics

51
Wiring Tips – Clean Up Diagram

Use the Clean Up Diagram tool to reroute multiple


wires and objects and to improve readability.
1. Select a section of your block diagram.
2. Click the Clean Up Diagram button on the block diagram
toolbar.

52
Block Diagram- 資料流
Block Diagram( 程式方塊圖 )
 資料流槪念
 由左而右執行
 所有 Input 到了才會執行

由左向右執行
Summary—Quiz
1. Which function executes
first: Add or Subtract?
a) Add
b) Subtract
c) Unknown

54
Summary—Quiz Answer
1. Which function executes
first: Add or Subtract?
a) Add
b) Subtract
c) Unknown

55
Summary—Quiz
2. Which function executes
first: Sine or Divide?
a) Sine
b) Divide
c) Unknown

56
Summary—Quiz Answer
2. Which function executes
first: Sine or Divide?
a) Sine
b) Divide
c) Unknown

57
Dataflow – Quiz
Which node executes first?
a) Add
b) Subtract
c) Random Number
d) Divide
e) Sine

58
Dataflow – Quiz Answers
No single correct answer.

Which node executes first?


a) Add – Possibly
b) Subtract – Definitely not
c) Random Number – Possibly
d) Divide – Possibly
e) Sine – Definitely not

59
Group Exercise Concept: Dataflow

Which Express VI executes last?


Group Exercise Concept: Dataflow

Which Express VI executes last?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy