650 likes | 1.14k Views
LabVIEW 7.1 寒假短期教學課程. 歐陽丞修. 2006/02/06. LabVIEW 簡介. LabVIEW (Laboratory Virtural Instrument Engineering Workbench ) 虛擬儀表 (VI,Virtual Instrument) 量測 、 呈現與分析資料 G 語言 (Graphic Language). 虛擬儀表 (Virtual Instrument). Virtual instrument has all main properties of the real one,
E N D
LabVIEW 7.1寒假短期教學課程 歐陽丞修 2006/02/06
LabVIEW簡介 • LabVIEW (Laboratory Virtural Instrument Engineering Workbench ) • 虛擬儀表(VI,Virtual Instrument) • 量測、呈現與分析資料 • G 語言(Graphic Language)
虛擬儀表 (Virtual Instrument) • Virtual instrument has all main properties of the real one, • being „only” computer program.
Virtual Instrumentation With LabVIEW 人機介面 程式方塊
開啟LabVIEW • 開始=>程式集=>National Instrument LabVIEW 7.1
人機介面 Front Panel 程式方塊圖 Block Diagram
建立VI程式 狀態面板 工具面板 控制面板
工具面版 • Floating Palette • Used to operate and modify front panel and block diagram objects. Automatic Selection Tool Scrolling Tool Breakpoint Tool Probe Tool Color Copy Tool Coloring Tool Operating Tool Positioning/Resizing Tool Labeling Tool Wiring Tool Shortcut Menu Tool
狀態面版 Run Button Continuous Run Button Abort Execution Pause/Continue Button Text Settings Align Objects Distribute Objects Reorder Resize front panel objects Additional Buttons on the Diagram Toolbar Execution Highlighting Button Step Into Button Step Over Button Step Out Button
LabVIEW介面 • 控制元(Input)與顯示元(Output) Front Panel
Block Diagram 控制元接點 接線 節點 顯示元接點
Wiring Tips – Block Diagram Wiring “Hot Spot” Click To Select Wires Clean Up Wiring Use Automatic Wire Routing
建立子程式(SubVIs) • A SubVI is a VI that can be used within another VI • Similar to a subroutine • Advantages • Modular • Easier to debug • Don’t have to recreate code • Require less memory
Steps to Create a SubVI • Create the Icon • Create the Connector • Assign Terminals • Save the VI • Insert the VI into a Top Level VI
呼叫子程式 若為常數有何好處 SubVI 內容
迴圈種類 i=0; do { … i++; } while (i<10) i=0; while (i<10) { … i++; } • C語言 for (i=0;i<10;i++) { … } For Loop While Loop Do … While Loop
For Loop 次數(N) 目前執行完畢的迴圈數
For Loop for (i=0;i<10;i++) { … } 位移暫存器 (0~N-1)
For Loop 結果有何差異??
目前執行的迴圈次數 狀態接點 While Loop
While Loop i=0; while (i<10) { … i++; } i=-1; do { … i++; } while (i<10)
While Loop 錯誤!! 正確!!
While Loop 等效
Case structure if (Number >= 0) then Square Root Value= SQRT (Number) else Square Root Value = -99999 Display Error Message end if
Sequence Structure Stacked Sequence Structure Flat Sequence Structure