LabVIEW Programming Environment and Basic Operations

Preview:

Citation preview

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

LabVIEW

LabVIEW• Originally developed for communication

with laboratory devices.• Communication Through

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

Virtual Instrument

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

Virtual Instrument• Virtual instrumentation also combines hardware and software with

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

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

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.

Front Panel

Front Panel

IndicatorsControls

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

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

Block Diagram

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

Block Diagram Toolbar

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

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.

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.

LabVIEW Palettes•The Front panel contains:

The Controls Palette

•The Block Diagram panel contains:

The Functions Palette

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

panel

• Or click the mouse right button

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

Some Controls

Some Controls

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

diagram window

• Or click the mouse right button

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

Some Functions

Some Functions

Some Functions

Some Functions

Some Functions

Some Functions

Some Functions

Some Functions

Some Functions

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

diagram window or front panel

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

Tools palette

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

Creating VIs

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

Control

Indicator

Creating VIs• Example 2: Add and Subtract two numbers

ControlsIndicators

Creating VIs• Example 3: Slope of a Line

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

Creating SubVIs• Step #2: Create the Connector

Creating SubVIs• Step #3: Select the terminals pattern

according to the number of inputs and outputs

Creating SubVIs• Step #4: Assign Terminals

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

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.

Context Help window

Context Help window• To activate the Context Help window

Context Help window

• Context Help window contains:

Context Help window Terminals

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

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.

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.

Context Help Three Keys

1- Hide Optional Terminals and Full Path:

Context Help Three Keys

2- Lock Context Help:

Context Help Three Keys

3- Detailed help:

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

Recommended