You are on page 1of 11

NI LabVIEW Demonstration

(For Course: Transducers and Measurement Systems)

Introduction to NI LabVIEW
LabVIEW is an acronym for Laboratory Virtual Instrumentation Engineering Workbench. It is one of the leading industrial software packages for control and intrumentation today and finds application in a large number of research agencies like BARC, CSIO, IGCAR, DRDO etc. and also in industries like power plants, petrochemicals etc. LabVIEW is currently expanding its wings in India and is the next big thing in Indian manufacturing plants as more and more of the new plants are turning to it. Hence, knowledge of LabVIEW is essential for engineers, especially Instrumentation engineers as they directly deal with data acquisition from various sensors and control systems one of the major applications of NI LabVIEW. In this file, there are three step-by-step tutorials that will guide you through LabVIEW based applications. Please note the techniques that have been used to implement the features as you will also be required to use the same for your assignments. The version used for making this tutorial is NI LabVIEW 7.1.

Tutorial 1 A very basic calculator


This tutorial guides you on your way to make a very simple calculator in LabVIEW that implements functions like addition, subtraction, multiplication, division, factorial, modulus, quotient-remainder etc. You can put in as many features as you like. Expected LabVIEW skills acquired by this tutorial: Data manipulation and basic calculations Toolkits/Palettes used: Numeric, Comparison, Exec Ctrl etc. 1) Open a new Blank VI. 2) On the front panel, right click and select Num Ctrls and select Num Ctrl. A simple left-click enables the selection and left-clicking on the front panel places the desired selection there. Do this twice to get two controls on your front panel.

3) Now go to the Num Inds menu and select a Num Ind and place it into the front panel. In LabVIEW, a control means an input parameter and an indicator means an output field. In your calculator, you will be feeding data into the controls and getting the output in the indicator. 4) Now go to your block diagram using the shortcut Ctrl+E (standard shortcut memorise). Your block diagram should look pretty much empty except for three boxes, two of them having a triangle the right (Control) and one having a triangle at the left side (Indicator).

5) When you bring your mouse pointer near these triangles, you will notice the pointer is replaced by a barrel this indicates that clicking at that point will start a wire from that control/indicator. The wire is used for dataflow just like the telephone line wires. Wires of different data-types have different colors. 6) Now right-click on an empty area in the block diagram and go to All Functions>Numeric>Add and place it onto the block diagram.

7) The Add block has two inputs wire the two controls on your block diagram to these inputs. To wire successfully, start a wire from the control, bring it near to the Add input node and wait for the barrel to appear again when it does, just left-click. 8) Wire the output of your Add block to the indicator on the block diagram. 9) Once done, go to your front panel, give some inputs to your controls and press the Run button in the menu bar. Or use the short cut Ctrl+R (standard shortcut memorise). 10) You have successfully implemented addition function. But now, you want to implement other functions as well, depending on the users requirements. For this we will use the Case structure and the Menu ring. 11) The Menu Ring option is enabled by the following sequence: Front Panel>Controls>All Controls>Ring and Enum>Menu ring. It helps you create a drop-down list for your application; hence our purpose will be served. 12) Right-click on the Menu ring you just placed on the Front panel and go to the Edit items menu. Add labels like Add, Subtract, Multiply, Divide, Q and R etc. You will notice that each of these corresponds to a number 0, 1, 2 and so on.

13) Go to the Block Diagram>Right click>Exec Ctrl>Case Structure. The case structure is a conventional case structure as in C/Java etc. It executes a piece of code according to a given input. The input to the Case structure is wired to the ? node. 14) Wire the Menu ring output to the input node of the Case structure. Also, add cases to the Case Structure by right clicking on the existing case and select Add Case After. 0 corresponds to Add, 1 to Multiply and so on. 15) Place the Add block in the 0 case, Subtract block in 1 case, Multiply in 2 case and so on. 16) Wire your controls to the any block that you placed in the Case structure. You will notice that a tunnel is formed on the boundary of the Case structure. This means that it is already wired to the Case structure. Hence, from now on, you dont need to wire your control all the way. Just drag wires from the tunnels for the other cases. Once, you are done with the entire wiring, you can run the program. 17) Try out different selections and check output. Your basic calculator is ready.

Thank you!

Tutorial 2 Data Presentation using Graphs and Charts


This tutorial guides you on your way to present your data using graphs and charts in LabVIEW. Data presentation is integral to any project/report. LabVIEW provides facilities like XY-Graphs, Waveform Charts etc. for effective presentation of data. This data may be generated run-time or can be derived from a spreadsheet. Expected LabVIEW skills acquired by this tutorial: Data presentation using Waveform Charts, Test Signal Generation Toolkits/Palettes used: Graph Inds, Input, Exec Ctrl etc. The Waveform Chart The waveform chart lets you plot your data against time and will be useful for you during your interfacing stage of the assignment. The following steps should let you know the basics of waveform chart and how to make a simple plot using it. 1) Open a Blank VI and on the Front Panel, right-click>Graph Inds>Waveform Chart. Place it onto the Front Panel.

2) Right Click on the Waveform chart and explore the various features of it especially the Data Operations and the Properties you will be using them the most.

3) Our aim is to display various types of signals in a single waveform chart. Hence, here too, we will be using the Menu Ring option to generate a drop-down list for selection of the type of signal. 4) Generate a drop-down menu, as done in the first tutorial with the various fields being Sine Wave, Square Wave and Triangular Wave. 5) Now switch to the Block Diagram. In the Block Diagram, create a While Loop by the following action: Right-Click>Exec Ctrl>While Loop. The While Loop is like a container which executes the code inside it repeatedly until the termination condition indicated by the red circle at the bottom right is met. In LabVIEW 7.1, the While Loop automatically has a Boolean button wired to the termination condition. The user can simply end the While Loop by setting the button to an appropriate logic on the Front Panel. 6) Now wire the Menu Ring to a Switch Case as done in the previous tutorial here, 0 corresponds to Sine Wave, 1 corresponds to Square Wave and 2 to Triangular Wave. 7) Signal Generation: You can simulate certain types of signals in LabVIEW like Sine, Square, Triangular, Sawtooth and some more. Do the following action in the Block Diagram: RightClick>Input>Simulate Sig and place it onto the Block Diagram. As soon as you place it, a dialog box opens that allows you to change the signal properties including the frequency, the number of samples to be displayed, the type etc. You will use this feature often to test the logic you have made using LabVIEW.

8) Place one such selection in each of the cases of the Switch structure and wire the outputs to the Waveform Chart.

9) Run the VI. Try to provide options to change the frequency at run-time, changing the nature of signal etc. and see how the chart behaves.

Thank you!

Tutorial 3 A simple tank level alarm system


This tutorial guides you on your way to developing a very elementary tank level alarm system. In this application, whenever the tank level drops below a particular level, an alarm LED will glow and water will start filling automatically into the tank till a particular level is reached when the alarm turns off. The basic purpose is to show how logic is implemented in LabVIEW. Expected LabVIEW skills acquired by this tutorial: Logic development in LabVIEW Toolkits/Palettes used: Local Variables, Exec Ctrl, Boolean and Comparison etc. Logic Development: The following flowchart enlists the various actions to be taken-

1) Place the following on your Front Panel: A Tank indicator, One Push-button ( 1 X Outgoing valve), Three Square LEDs (2 X Alarm, 1 X Incoming Valve) and arrange them on your panel such that the incoming valve is near the top of the tank, the outgoing valve at the bottom and the ALARM LEDs are placed together. Suitably name each object by changing the label. (Simply double-click on the label to change the name) 2) Let the max. value of the tank indicator be 1000 liters. Let the lower limit be 150 liters and upper limit be 800 liters. Let the max. capacity of the incoming valve be 20 liters/second and that for the outgoing valve be 25 liters/second. 3) Try to implement the above-mentioned logic using Switch structure, Numerical palette, While/Timed loop. 4) An implementation of the flowchart may be made available to you at a later stage. Check your implementation against it. This is how the Front Panel and the Block diagram may look like.

Front Panel:

Block Diagram:

Consult the PAs present to clear any doubts regarding Timed Loops, Case structures or any other basic doubts.

Thank you!

Prepared by: Shashank Kulkarni (Professional Assistant 1st semester 2011)

You might also like