Docsity

Introduction to LabVIEW, Lab Reports of Analog Communication

Partial preview of the text

Download Introduction to LabVIEW and more Lab Reports Analog Communication in PDF only on Docsity!

LAB# 05 Introduction to LAbView

EEE351-Principles of Communication Systems

Lab Report # 03

Name RANA MUHAMMAD AHMED

Registration Number

FA19-BEE-180/ISB

Class/Section

BEE-5D

Instructor’s Name

SIR KHAN ASFAR

Lab Assessment

Pre Lab

In Lab

Critical Analysis

LAB# 05 Introduction to LabVIEW

Objectives

This lab introduces LabVIEW software. Familiarise the students with the following concepts:

Basic Introduction to LabVIEW

  • Front Panel
  • Block Diagram
  • Construct a VI
  • Programming Structures (If/Else, For Loop)

1. LabVIEW Overview:

1.1. What is LabVIEW:

➢ LabVIEW(Laboratory Virtual Instrument Engineering Workbench), is a

graphical programming language that uses icons instead of lines of text to

create applications.

➢ LabVIEW programs/codes are called Virtual Instruments, or VIs for short.

➢ LabVIEW is used for Data acquisition, signal Processing (Analysis), and

hardware control–a typical instrument configuration based on Labview.

2. Schematic diagram of an instrument system based on LabVIEW

Figure 1.

3. Virtual Instruments (VI)

A VI consists of

3.1. Front Panel: Top-level (user) interface

User interface to the code (as shown in figure 1.2)

➢ Controls (Input): Boolean controls, Numerical controls, etc.

➢ Indicators (Output): Graphs, Charts, Numerical indicators, etc.

Figure 1.

4. Components of a block diagram

The components of a block diagram belong to one of the three classes:

➢ Nodes: Program execution elements.

➢ Terminals: Ports through which data passes between the block diagram and the front

panel, and between nodes. Terminal is any point to which you can attached a wire to

pass data.

➢ Wires : Data paths between terminals.

4.1. Nodes

There are three nodes types: Functions, subVI nodes, and structure.

➢ Functions are the build-in nodes such as adding number, file I/O.

➢ SubVI nodes VIs that you design and later call from another VI.

➢ Structures control the grogram flow, such as For Loops and while Loops.

5. Controls Palette

It consists of many sub-palettes that can be used to create front panels.

➢ Control: Controls simulate input devices (such as knobs, push button and dials) and provide a

pipeline to move data to the Black Diagram.

➢ Indicator: Controls simulate out devices to display the output result (in chart, graph…).

Controls Palette is available at View pull-down menu in the Front Panel.

6. Functions Palette

The Functions Palette consists of many sub-palette that contain almost all available objects that

can be used to create the block diagram. It contains functions as well as many VIs or Sub-VIs

that ship with LabVIEW. Function Palette is available at View menu in the Block Diagram

Window.

7. Programming Structures

7.1. If/else

LabVIEW (like C or Matlab) supports the following structures:

➢ If / Else

➢ For loop

➢ While loop

These can be found in ‘Structures’ in the Programming Palette, by right clicking on the Block

Diagram.

LabVIEW is graphical, so code of the form below is written graphically

if{condition = true}

{Program for true condition}

else (if{condition = false})

{Program for false condition}

Basic Steps

➢ Use a comparison to produce a true or false, then wire that result to the Case

Structure

➢ Place code in both the True and False parts of the case structure selected at the top of the

structure

➢ When the code runs, a true boolean value will run the True case, while a false will run the

False case

7.2. For Loop

‘For loop’ in LabVIEW is the same as in other languages

➢ Each for loop has a ‘Loop Count’ input to the loop and a ‘Loop Iteration’ output inside the

loop

➢ Simply wire up the number of loops you require to Loop Count and put appropriate

code inside loop

Task 01:

Construct a VI to add two numbers.

a=x+y

Procedure:

  1. Start >> LabVIEW >> Blank VI (from ‘Getting Started’ screen
  2. On the Front Panel, add two ‘Numeric Controls’ (inputs) and one ‘Numeric Indicator’

(output)

  1. Name them ‘x’, ‘y’ and ‘x+y’
  2. Switch to the Block Diagram – note the inputs and outputs (same names as Front

Panel)

Task 02:

Input a numerical data from the Front Panel (numerical control) and display the result b

(Numerical Indicator) after multiplication:

b = constant ⋅a.

Procedure:

  1. Find and drag the Numerical Control and Numerical Indicator respectively, to the from

Panel:

View – Controls Palette – Modern – Numeric – Numerical Control /Numerical Indicator

  1. Find and drag Multiply an Numerical Constant, respectively, into the Background

Diagram:

View – Functions Palette – Programming - Numeric – Multiply/Numerical Constant

  1. Wire the associated icons. Running the code.

Task 03:

Create a VI to add ‘5’ to a number if it is greater than ’10’, else add ’10’

Procedure:

  1. Open a blank VI
  2. On the Front Panel, insert a ‘numeric control’ to obtain the input number and a ‘numeric

indicator’ for the ouput

  1. In the Block Diagram, go to ‘Structures’ in the Programming Palette (right click for the

Palette)

  1. Click on ‘Case structure’, drag and drop it onto the Block Diagram. Adjust the size of the

structure as needed

  1. Insert a ‘ Greater?.vi ’ from ‘Comparison’ in the Programming Palette
  2. Compare the input to a ‘constant’ (Numeric << Programming Palette) set to 10.
  3. If the condition (number > 10) = True, set the case structure to ‘True’ and ‘Add’ 5 to the

number

  1. If the condition (number > 10) = False, set the case structure to ‘False’ and ‘Add’ 5 to the

number

  1. Edit the icon and the connector, after saving the VI

Critical Analysis / Conclusion

In this lab, we learn the use of a tool called LABVIEW.

LABVIEW is the software which uses icons instead of data for

the coding of any programme or application.In above lab, we

performed Different operations such as Addition,

Multiplication, If else loop, on LABVIEW. Basically

LABVIEW have two different windows, front panel and block

diagram. On front panel, we designed icon as an input for the

programme. And in block diagram, we designed the whole logic

and visual coding of that programme.