graphical programming · • graphical programming • easy to use • faster development time •...

34
LV Basics I 1 Graphical Programming Easy to use Faster Development Time Graphical User Interface Graphical Source Code Easily Modularized Application Builder to create stand-alone executables Localized in French, German, and Japanese

Upload: others

Post on 27-Jul-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 1

• Graphical Programming• Easy to use• Faster Development Time• Graphical User Interface• Graphical Source Code• Easily Modularized• Application Builder to create stand-alone

executables• Localized in French, German, and

Japanese

Page 2: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 2

Multi-Platform Compatibility

• Platform neutral

• Migrate applications between platforms

Page 3: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 3

Network-based Measurement & Automation

AcquireAnywhere

AnalyzeAnywhere

PresentAnywhere

Your entire Measurement and Automation system can be controlled with LabVIEW

locally, or over the Internet

Network Network

Page 4: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 4

Virtual Instruments (VIs)

Front Panel• Controls = Inputs• Indicators = Outputs

Block Diagram• Accompanying “program”

for front panel• Components “wired”

together

Page 5: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 5

Icon/Connector

• An icon represents a VI in other block diagrams

• A connector passes data to and receives data from a “subVI” through terminals

icon

connector

terminals

Page 6: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 6

Example: Temperature VI

SubVI from previous slides

Page 7: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 7

Panel Window

Panel Toolbar

IconPane

Digital Control

KnobOwned Label

KnobControl

GraphLegendXY Graph

Page 8: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 8

Diagram Window

Wire Data

GraphTerminal

SubVIFor LoopStructure

Digital ControlTerminal

MultiplyFunction

Numeric Constant

Knob Terminal

Timing Function

Page 9: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 9

Status Toolbar

Run button

Continuous Run button

Abort button

Pause/Continue button

Execution Highlighting button

Step Into buttonStep Over button

Step Out button

Warning indicator

Enter button

Additional Buttons on the Diagram Toolbar

Font ring

Alignment ring

Distribution ring

Reorder ring

Page 10: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 10

Menus

• Pull Down Menus

• LabVIEW Shortcut Menus

Windows and UNIX - Right-Click on object with mouse

Macintosh - Hold down open-apple and click with mousebutton

Page 11: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 11

Tools Palette

• Operating Tool

• Positioning/Resizing Tool

• Labeling Tool

• Wiring Tool

• Pop-Up Menu Tool

• Scrolling Tool

• Breakpoint Tool

• Probe Tool

• Color Copying Tool

• Coloring Tool

• Editing and Debugging Tools

• Floating Palette

Page 12: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 12

Control and Function Palettes

• Graphical, floating palettes • Subpalettes can be converted to

floating palettes

Controls Palette (Panel Window)

Functions Palette (Diagram Window)

Find

Browser OptionsUp one level

Page 13: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 13

Help Options

Show Context Help (Help menu)• Simple/Detailed Diagram Help• Lock Help• Online Help

Contents and Index (Help menu)• All menus online• Right-click on functions in diagram to

access online info directly

Page 14: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 14

Summary

• Virtual instruments (VIs) have three main parts: the front panel, the block diagram, and the icon/connector

• The front panel is the user interface of a LabVIEW program and the block diagram is the executable code

• Menu options allow you to access different features in LabVIEW

• Use shortcut menus to customize any object in LabVIEW. Right mouse click on Windows and UNIX or Command-click for Macintosh

• Floating Palettes• Tools Palette • Controls Palette (only when Panel Window is active)• Functions Palette (only when Diagram Window is active)

• There are help utilities including the Context Help Window and Contents and Index...

Page 15: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 15

Creating a VI Front Panel

• Numeric controls and indicators• Boolean controls and indicators• Configuring controls and indicators

– Use shortcut menus– Parts have different menus

DigitalControl

DigitalIndicator

Labels

Increment Buttons Boolean

Control BooleanIndicator

Page 16: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 16

Accessing Shortcut Menus

Windows & UNIX: Right-Click

Macintosh: Control-Click

Right-click on the label for its shortcut menu Right-click on the digital

display for its shortcut menu

Page 17: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 17

Terminal pattern for theAdd Function and theSubtract function (three node terminals).

Creating a VI Block Diagram

NodesWires

ControlTerminals

Diagram Window

Panel Window

Indicator Terminals

Page 18: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 18

Wiring a VI Block Diagram

Hot Spot

Tools to Help Wiring

- Automatic Wiring- Tip Strips- Right-click on terminals and select Show Terminals- Context Help Window

Scalar 1D Array

Numeric

Boolean

String

Orange (floating point)Blue ( integer)

Green

Purple

2D Array

Page 19: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 19

Dataflow Programming

• 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

Page 20: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 20

Debugging Techniques

• Finding Errors

• Execution Highlighting

• Probe

Click on broken Run buttonWindow showing error appears

Click on Execution Highlighting button; data flow is animated using bubbles. Values are displayed on wires.

Right-click on wire to display probe and it shows data as it flows through wire segment

You can also select Probe tool fromTools palette and click on wire

Page 21: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 21

Debugging Techniques

• Breakpoints

• Step Into, Over, and Out buttons for Single Stepping

Click on Step Into button to enable single steppingOnce Single Stepping has begun, the button steps into nodes

Click on Step Over button to enable single stepping or to step over nodes

Click on Step Out button to step out of nodes

Select Breakpoint tool from Tools palette and click on wire or node where you want execution to pause

Page 22: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 22

Summary

• You place controls (inputs) and indicators (outputs) in the panel window

• Use the Operating tool to manipulate panel objects. Use the Positioning tool to select, move, and resize panel objects. Use the Wiring tool to connect diagram objects

• Control terminals have thicker borders than indicator terminals

• All LabVIEW objects have shortcut menus

• Wiring is the mechanism to control dataflow and produce LabVIEW programs

• Broken Run arrow = nonexecutable VI

• Various debugging tools and options available such as setting probes and breakpoints, execution highlighting, and single stepping

Page 23: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 23

While Loop

Do

(Execute diagram inside Loop)

While Condition is TRUE

1. Select While Loop2. Enclose code to be repeated

3. Drop or drag additional nodes and then wire

Page 24: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 24

Select the Loop Condition

• Right-click on Conditional Terminal to define when the loop stops

Iteration Terminal Conditional Terminal

Page 25: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 25

Waveform Charts

• Selected from the Controls >> Graph subpalette

Page 26: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 26

Wiring to Charts

• Single-Plot Chart

• Multiple-Plot Chart

Page 27: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 27

Mechanical Action of Booleans

• Switch action:

Control is toggled

until changed by

hand

• Latch action:

Control reverts to

default state when

read by diagram

Page 28: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 28

Shift 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

Before Loop

BeginsFirst

IterationSecondIteration

LastIteration

Initial Value

Value 1

Value 1

Value 2

Value 2

Value 3

Value 3InitialValue

Page 29: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 29

Additional Shift Register Elements

Latest valueis passed toright terminal

Right-click on left terminal to add new elements

Previous values are available at the left terminals

Right-click on the border for a new shift register

1 loop ago

2 loops ago

3 loops ago

Page 30: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 30

Initializing Shift Registers

RUN 1

RUN 2

Initial Value = 5

Initialized Uninitialized

Initial Value = 5

Initial Value = 0

Initial Value = 8

Page 31: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 31

Customizing Charts and Graphs

• Plot Legend (color, point style, line style, etc.)

• Digital Display

• Scrollbar

• Customize the X and Y Axes

• Graph Palette

• Scale Legend

Page 32: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 32

For 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

Count terminal(Numerical input)

Page 33: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 33

Numeric 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

Page 34: Graphical Programming · • Graphical Programming • Easy to use • Faster Development Time • Graphical User Interface • Graphical Source Code • Easily Modularized • Application

LV Basics I 34

Summary

• 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