cs320n –visual programming more labview foundations

13
CS320n –Visual Programming More LabVIEW Foundations

Upload: lambert-turner

Post on 13-Dec-2015

224 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: CS320n –Visual Programming More LabVIEW Foundations

CS320n –Visual Programming

More LabVIEW Foundations

Page 2: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 2

What We Will Do Today• Look at some more features of LabVIEW

• Work on exercises involving debugging and creating sub VIs

Page 3: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 3

VI Libraries• VIs can be saved as

individual programs• A group of VIs can be

saved together as a VI library

• creating -> an option in the save window

• opening -> open as regular file, then select which VI to open from library

Page 4: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 4

From Last Time• Some functions have a variable

number of inputs

• The string concatenation function

• When opened notice blue dots on top and bottom

• function can be expanded for more inputs– note visual cue on order of inputs in

result for three input function

Page 5: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 5

Debugging• VIs that are broken cannot be run

– analogous to syntax error in text based programming languages

• Most common mistakes– required input missing on function terminals (for

example, add)– type mismatch on data (wire double when integer was

expected– loose, unconnected wires– sub VI is broken– multiple inputs into a single indicator

Page 6: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 6

Broken Programs• Clicking on the broken arrow brings

up a list of errors

• Clicking on an error displays more information about the error

Page 7: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 7

Stepping Through a Program• Sometimes you want to observe a program step

by step, not all at once• Click on the single set button instead of the run

button• Press the single step button to see the flow of

the program

Page 8: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 8

Execution Highlighting• Another excellent debugging tool is Execution

Highlighting– aside: why no debugging tools in Alice?

• Select “Highlight Execution” and data values and movement shown as program runs. Very useful

• Can be used as program runs or combined with stepping through program

Page 9: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 9

Probes• To view the value on a wire or result

of a function you can either set up an indicator or use a probe

• With a running program, probe is auto selected when putting the cursor near a wire

• When the program is not running probes can be added.– choose the “Window” menu– select “Show Tools Palette”– click on the probe tool to add probes– be sure to change Tool back to auto

select when finishedprobe

Page 10: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 10

Breakpoints• Suppose you want to stop the

program at a single point, deep into the execution

• using the step by step control is a pain

• set a breakpoint– right click or use breakpoint tool– program will run normally until it

hits that point

break point on wireand function

Page 11: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 11

Creating sub VIs• If you create a program and want to use

that in other program you can create a Sub VIs

• steps in creating a sub VI– assign VI controls and indicators to wire

terminals on its connector pane so that data can be passed into and out of the VI

– create an icon for the VI

Page 12: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 12

C to F• Create icon

– right click on icon in upper right corner and select “Edit Icon”

Page 13: CS320n –Visual Programming More LabVIEW Foundations

Visual Programming LabVIEW Foundations 13

Assign Connectors• Defining parameters

– like in Alice

• Right click icon on the front panel. (Not the block diagram.)

• Select “Show Connector”– two terminals– input / control on left– output / indicator on right

• click in left hand terminal / box on icon and select front panel control to set

• repeat for right hand side terminal