Title: LabVIEW Course
1LabVIEW Course
2Week 2 Part ACreating a SubVI
You Will Learn
A. What a SubVI is B. How to create the icon and
connector C. How to use a VI as a subVI D. How to
use the Create SubVI menu option
3SubVIs
Means of using a VI in the block diagram of a
higher-level VI Requires icon and connector
4SubVI Example Calculating Slope
5Creating the Icon
- Right-click in the icon pane (Panel or Diagram)
- Always create a black and white icon
6Creating the Connector
Right-click in the icon pane (Panel only)
7Creating the Connector - cont.
Click
8The Connector Pane
- The terminal colors match the data types to which
they are connected - Click on the terminal to see its associated front
panel object
9Using the VI as a SubVI
- Changes made to subVI saved in memory until saved
to disk - Calling subVIs
- FunctionsSelect a VI
- OR
- Drag icon onto target diagram
10Help and Classifying Terminals
Classify inputs and outputs How displayed in
Context Help Window Required - Bold label
Recommended - Normal text Optional - Visible
or wire stubs shown
11Documenting the VI
- Document VIs - VI PropertiesDocumentation
- Document objects - Description and Tip...
VI Documentation
Description and Tip
12The Create SubVI Option
- Enclose area to be converted into a subVI
- Select Create SubVI from the Edit Menu
13Summary
- VIs can be used as subVIs after you make the icon
and connector - Icon created using Icon Editor
- Connector defined by choosing number of terminals
- Load subVIs using the Select a VI... option in
the Functions palette or dragging the icon onto a
new diagram - Online help for subVIs using the Show Context
Help option - Descriptions document functionality
- Use Create SubVI feature to easily modularize the
block diagram
14Week 2 Part BLoops and Charts
You Will Learn
A. About While Loops B. About waveform
charts C. How to use shift registers D. About For
Loops
15While Loop
2. Enclose code to be repeated
1. Select While Loop
3. Drop or drag additional nodes and then wire
Do (Execute diagram inside
Loop) While Condition is TRUE
16Select the Loop Condition
- Right-click on Conditional Terminal to define
when the loop stops
Iteration Terminal
Conditional Terminal
17Waveform Charts
Selected from the ControlsGraph subpalette
18Wiring to Charts
Single-Plot Chart Multiple-Plot Chart
19Mechanical Action of Booleans
- Switch action Control is toggled until changed
by hand - Latch action Control reverts to default state
when read by diagram
20Modifying Numeric Controls Indicators
- Setting the digits of precision
21Shift Registers
Available at left or right border of loop
structures Right-click on border and select Add
Shift Register Right terminal stores data on
completion of iteration Left terminal provides
stored data at beginning of next iteration
22Additional Shift Register Elements
Previous values are available at the left
terminals
Right-click on left terminal to add new elements
Right-click on the border for a new shift register
Latest value is passed to right terminal
1 loop ago 2 loops ago 3 loops ago
23Initializing Shift Registers
Initialized
Uninitialized
RUN 1
Initial Value 5
Initial Value 0
RUN 2
Initial Value 5
Initial Value 8
24Customizing Charts and Graphs
- Plot Legend (color, point style, line style,
etc.) - Digital Display
- Scrollbar
- Customize the
- X and Y Axes
- Graph Palette
- Scale Legend
25For Loop
In Structures subpalette of Functions
palette Enclose code to be repeated and/or
resize and add nodes inside boundary Executes
diagram inside of loop a predetermined number of
times Shift registers can be created at the
border
26Numeric Conversion
- Numeric defaults to double precision (8 bytes) or
long integer (4 bytes) - LabVIEW automatically converts to different
representations - Gray coercion dot on terminal indicates conversion
27Summary
- Two structures to repeat execution
- While Loop
- For Loop
- Loop timing controlled using Wait Until Next ms
Multiple function -
- Three modes of waveform charts
- Strip chart
- Scope chart
- Sweep chart
-
- Charts can be customized right-click on chart
for menus - Shift registers transfer data values from one
iteration to the next - Adapt to any data type
- Additional left terminals may be added to
access previous - iteration