55

LabVIEW Programming Environment and Basic Operations

Embed Size (px)

Citation preview

Page 1: LabVIEW Programming Environment and Basic Operations
Page 2: LabVIEW Programming Environment and Basic Operations

LabVIEW

• Laboratory Virtual Instrument Engineering Workbench.

• Development environment for the G ‘Graphical’language.

• Produced by National Instruments for all major operating systems.

• You can do anything with LabView that you can with C++ or any other scientific programming language

Page 3: LabVIEW Programming Environment and Basic Operations

LabVIEW

Page 4: LabVIEW Programming Environment and Basic Operations

LabVIEW• Originally developed for communication

with laboratory devices.• Communication Through

»GPIB»Serial RS-232 & RS-485»USB»VXI»PXI»Plug in Data Acquisition

Page 5: LabVIEW Programming Environment and Basic Operations

Virtual Instrument

• Virtual Instrument is an instrument has the all main properties of a real one, but it is being “only” a computer program

Page 6: LabVIEW Programming Environment and Basic Operations

Virtual Instrument• Virtual instrumentation also combines hardware and software with

industry-standard computer technologies to create user-defined instrumentation solutions.

Page 7: LabVIEW Programming Environment and Basic Operations

Virtual InstrumentLabVIEW VIs contain three main components: the front panel, the block diagram, and the icon/connector pane.

Page 8: LabVIEW Programming Environment and Basic Operations

Front Panel• The front panel is the user interface for the VI. • It contains the Front Panel toolbar and the Controls palette. • You build the front panel with controls and indicators.

Page 9: LabVIEW Programming Environment and Basic Operations

Front Panel

Page 10: LabVIEW Programming Environment and Basic Operations

Front Panel

IndicatorsControls

Page 11: LabVIEW Programming Environment and Basic Operations

Front Panel Toolbar

Errors in the VI

To run the VI For objects alignment

The VI is runningFor objects spacing

For continuous run

VI is running continuously

To abort execution

Pause execution, continue by another click

Text settings

To order objects which to front and back

Page 12: LabVIEW Programming Environment and Basic Operations

Block DiagramThe block diagram provides the area for the graphical code.

Page 13: LabVIEW Programming Environment and Basic Operations

Block Diagram

For each Control or Indicatorin the front panel corresponding terminal in the block diagram generated automatically

Page 14: LabVIEW Programming Environment and Basic Operations

Block Diagram Toolbar

Page 15: LabVIEW Programming Environment and Basic Operations

Block Diagram ToolbarHighlight: To high light execution and see how the data flow

Step Into: To see the execution step by step and it enters the SUBVI and Loops

Step Over: To see the execution step by step by pressing it, SUBVI and Loops Considered one step, it does not enter to it.

Step Out: To exit the loop or SUBVI in one step and navigate to next node

Page 16: LabVIEW Programming Environment and Basic Operations

Icon/Connector pane• You can use a VI as a subVI. • A subVI is a VI that is used inside another VI. • To be used as a subVI, a VI must have an icon and a connector pane. • The connector pane is a set of terminals that corresponds to the controlsand indicators of that VI.

Page 17: LabVIEW Programming Environment and Basic Operations

Saving a VI• To save a VI, select File>>Save.• When you have saved your VI, you can select File>>Save Asto access the Save As dialog box below.

Page 18: LabVIEW Programming Environment and Basic Operations

LabVIEW Palettes•The Front panel contains:

The Controls Palette

•The Block Diagram panel contains:

The Functions Palette

Page 19: LabVIEW Programming Environment and Basic Operations

1- Controls Palette• To open the control palette from the front

panel

• Or click the mouse right button

Page 20: LabVIEW Programming Environment and Basic Operations

1- Controls PaletteThe Controls palette contains the controls and indicators you use to create the front panel.

Page 21: LabVIEW Programming Environment and Basic Operations

Some Controls

Page 22: LabVIEW Programming Environment and Basic Operations

Some Controls

Page 23: LabVIEW Programming Environment and Basic Operations

2- Functions Palette• To open the Functions palette from the block

diagram window

• Or click the mouse right button

Page 24: LabVIEW Programming Environment and Basic Operations

2- Functions PaletteThe Functions palette contains the VIs and functions you useto build and design your program.

Page 25: LabVIEW Programming Environment and Basic Operations

Some Functions

Page 26: LabVIEW Programming Environment and Basic Operations

Some Functions

Page 27: LabVIEW Programming Environment and Basic Operations

Some Functions

Page 28: LabVIEW Programming Environment and Basic Operations

Some Functions

Page 29: LabVIEW Programming Environment and Basic Operations

Some Functions

Page 30: LabVIEW Programming Environment and Basic Operations

Some Functions

Page 31: LabVIEW Programming Environment and Basic Operations

Some Functions

Page 32: LabVIEW Programming Environment and Basic Operations

Some Functions

Page 33: LabVIEW Programming Environment and Basic Operations

Some Functions

Page 34: LabVIEW Programming Environment and Basic Operations

3- Tools Palettes• To open the Tools palette from the block

diagram window or front panel

Page 35: LabVIEW Programming Environment and Basic Operations

3- Tools PalettesThe Tools palette is available on the front panel and the block diagram to operate, edit and modify objects.

Tools palette

Page 36: LabVIEW Programming Environment and Basic Operations

Dataflow Programming

• Block diagram executes dependent on the flow of data; 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 37: LabVIEW Programming Environment and Basic Operations

Creating VIs

• Example 1: Converting ºC to ºF°F = (1.8 * °C) + 32

Control

Indicator

Page 38: LabVIEW Programming Environment and Basic Operations

Creating VIs• Example 2: Add and Subtract two numbers

ControlsIndicators

Page 39: LabVIEW Programming Environment and Basic Operations

Creating VIs• Example 3: Slope of a Line

Page 40: LabVIEW Programming Environment and Basic Operations

Creating SubVIs

• After you build a VI, create its icon and connector pane, then you can use it in another VI as a subVI .

• Step #1: Create the IconRight-click on the icon in the front panel

Page 41: LabVIEW Programming Environment and Basic Operations

Creating SubVIs• Step #2: Create the Connector

Page 42: LabVIEW Programming Environment and Basic Operations

Creating SubVIs• Step #3: Select the terminals pattern

according to the number of inputs and outputs

Page 43: LabVIEW Programming Environment and Basic Operations

Creating SubVIs• Step #4: Assign Terminals

Page 44: LabVIEW Programming Environment and Basic Operations

Creating SubVIs• Step #5: Save the file. Like “Slope.vi”• Step #6: Insert the VI into a Top Level VI

Page 45: LabVIEW Programming Environment and Basic Operations

LabVIEW Context Help window:

• This windows gives the basic information about the object that is in the front panel or block diagram

• This window appears just when you point to the object.

Page 46: LabVIEW Programming Environment and Basic Operations

Context Help window

Page 47: LabVIEW Programming Environment and Basic Operations

Context Help window• To activate the Context Help window

Page 48: LabVIEW Programming Environment and Basic Operations

Context Help window

• Context Help window contains:

Page 49: LabVIEW Programming Environment and Basic Operations

Context Help window Terminals

1- Required Terminals:The terminals that must be connected and it appear in a Bold font

Page 50: LabVIEW Programming Environment and Basic Operations

Context Help window Terminals

2- Recommended Terminals:The terminals that are better to be connected and it appear in a plain font, or it will take the default values.

Page 51: LabVIEW Programming Environment and Basic Operations

Context Help window Terminals

3- Optional Terminals:The terminals that are optional to beconnected and it appear in a dim font, or it will take the default values.

Page 52: LabVIEW Programming Environment and Basic Operations

Context Help Three Keys

1- Hide Optional Terminals and Full Path:

Page 53: LabVIEW Programming Environment and Basic Operations

Context Help Three Keys

2- Lock Context Help:

Page 54: LabVIEW Programming Environment and Basic Operations

Context Help Three Keys

3- Detailed help:

Page 55: LabVIEW Programming Environment and Basic Operations

Assignment #1:

Write a VI that calculate the roots of a second order equation.

AX^2 + BX + C = 0

Assume that the roots are real.

Run the VI with A=1, B=5 and C=6