LabVIEW - Introduction
LabVIEW - Introduction
Introduction to 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
Control:
Numeric
Customize
Palette View
Indicator:
Numeric Slide
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
28
Terminals
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
You can also select Probe tool from Tools palette and
click on wire.
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
Abort Execution
Additional Help
– Right-click on the VI icon and choose
Help, or
– Choose “Detailed help” on the context
help window
• 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
51
Wiring Tips – Clean Up Diagram
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.
59
Group Exercise Concept: Dataflow