LabVIEW Programming Examples Kansas State University

Labview Programming Examples Kansas State University-Free PDF

  • Date:18 Oct 2020
  • Views:4
  • Downloads:0
  • Pages:23
  • Size:1.36 MB

Share Pdf : Labview Programming Examples Kansas State University

Download and Preview : Labview Programming Examples Kansas State University


Report CopyRight/DMCA Form For : Labview Programming Examples Kansas State University


Transcription:

Telemark University College, Department of Electrical Engineering Information Technology and Cybernetics. Table of Contents,1 Customizing the LabVIEW Environment. 2 Wires and Variables,6 Clusters,7 Formula Node,8 Debugging. 9 Project Explorer,10 State Machine, Faculty of Technology Postboks 203 Kj lnes ring 56 N 3901 Porsgrunn Norway Tel 47 35 57 50 00 Fax 47 35 57 54 01. Telemark University College, Department of Electrical Engineering Information Technology and Cybernetics.
Customizing the LabVIEW Environment, Description LabVIEW has lots of possibilities for customizing the appearance and the use of the LabVIEW. environment Select Options from the Tools menu,Requirements LabVIEW 2009. Task In this example you will customize the LabVIEW Environment so it bests fits your demands The example. will go through the most important settings in the Options window Select Options from the Tools menu. The default settings is not necessary the best here are some recommendations for setting up the LabVIEW. environment Try the different settings above and see the difference and make your own personal choice. Setting Place front panel terminals as icons Category Block Diagram General. My Favorite, Faculty of Technology Postboks 203 Kj lnes ring 56 N 3901 Porsgrunn Norway Tel 47 35 57 50 00 Fax 47 35 57 54 01. Comments The setting to the right is my personal and recommended favorite For LabVIEW beginner is the. setting to the left easier to understand but it takes too much space in the Block Diagram. Setting Enable automatic wire routing Category Block Diagram Wiring. My Favorite, Comments This prevents LabVIEW from automatically connecting adjacent blocks The setting to the right is. my personal and recommended favorite When you use the setting to the right you have more control and. you may easy switch between the tools using the Tab key Although it seems useful to have auto wiring. enables it is my experience that the auto wiring is a little annoying since it tends to draw wires between blocks. when you do not want any wire etc, Setting Show front panel grid Category Front Panel Front Panel Grid.
My Favorite, Comments This setting shows a Grid pattern on the Front Panel in Edit mode I think this setting is. distracting but that is my opinion Note You may set the same setting for the Block Diagram. Setting Change Visible Categories, The next setting is not located in the Options window but I think it is worth mention is this context In the. Functions or Controls palette you may select which Categories that should be visible I recommend that you. Select All, Hans Petter Halvorsen Blog http home hit no hansha. Telemark University College, Department of Electrical Engineering Information Technology and Cybernetics. LabVIEW Wires and Variables Example, Description In text based programming languages you store and access data with functions through the use.
of variables In the LabVIEW graphical programming language wires implicitly handle all of the data storage. and access that are associated with variables in text based languages Think of wires as a path for data to flow. Data comes into block diagram objects through a wire and can leave only through a wire Local or Global. Variables are used to pass data when a wire in some situations cannot be used. Requirements LabVIEW 2009, Task Wires Create a program where you use Wires and Shift Registers to update data as shown below. Task Local Variables The Local Variable item is located on the Structures palette on the Block Diagram. When you place a Local variable on the Block Diagram it looks like a Question mark as seen below Then you. right click on the Local variable and choose Select Item and select which Control Indicator you want to. connect it to Another way to create a local variable is to right click on a Control Indicator either on the Front. Panel or the Block Diagram and select Create Local Variable. Faculty of Technology Postboks 203 Kj lnes ring 56 N 3901 Porsgrunn Norway Tel 47 35 57 50 00 Fax 47 35 57 54 01. Task Create the same program as in the previous task and use Local Variables instead. Task Global Variables Use global variables to access and pass data among several VIs When you create. a global variable LabVIEW automatically creates a special global VI which has a front panel but no block. diagram The Global Variable item is located on the Structures palette on the Block Diagram When you place a. Local variable on the Block Diagram it looks like a Question mark with a globe as seen above Double clink on. the item in order to create the Global Variable, Task Create 2 VIs that uses a Global variable to exchange data between them Example. Hans Petter Halvorsen Blog http home hit no hansha. Telemark University College, Department of Electrical Engineering Information Technology and Cybernetics. LabVIEW String Example, Description Working and manipulating with strings is an important part in LabVIEW development On the. Front panel we have the following String controls and indicators available from the Control palette. On the Block Diagram we have the following String palette available from the Functions palette in LabVIEW. In this Example you will learn how to use strings and string manipulation in LabVIEW. Requirements LabVIEW 2009,Task Concatenate Strings Create the following.
Faculty of Technology Postboks 203 Kj lnes ring 56 N 3901 Porsgrunn Norway Tel 47 35 57 50 00 Fax 47 35 57 54 01. Task Search and Replace String Create the following. Task Match Pattern Create the following,Task Format into String Create the following. Task String to Number and Number to String Create the following. Task Create the following Example You will need all you have learned above and more. Hans Petter Halvorsen Blog http home hit no hansha. Telemark University College, Department of Electrical Engineering Information Technology and Cybernetics. LabVIEW Arrays Example, Description Working and manipulating with Arrays is an important part in LabVIEW development Arrays are. very powerful to use in LabVIEW In all your applications you would probably use both One Dimensional Arrays. and Two Dimensional Arrays, On the Front Panel using the Control palette we can create an array as follows Array Matrix Cluster. subpalette, You drag and drop the empty Array on the Front Panel next you find a Control or Indicator Numeric String.
Boolean etc and drag it into the empty Array You can create an Array of almost any kind of Control or. 2D or multidimensional Array Just drag the mouse in the Index display to the left and increase the dimension. On the Block Diagram we have the following Array palette available from the Functions palette in LabVIEW. Use the Array functions to create and manipulate arrays The most useful Array functions are. Faculty of Technology Postboks 203 Kj lnes ring 56 N 3901 Porsgrunn Norway Tel 47 35 57 50 00 Fax 47 35 57 54 01. Array Size,Index Array Delete from Array Search 1D Array. Build Array Array Constant,Initialize Array Array Subset. All these functions are basic but very useful array functions you will probably be using in all your applications. Task Build Array This function concatenates multiple arrays or appends elements to an n dimensional array. Try the simple example below This example using the Build Array function inside a For loop in order build an. array with 10 elements, Task Index Array This function returns the element or subarray of n dimension array at index It is always. useful to find a specific value in an array The Index Array is extendible so you can drag it out to find more than. one elements Try the simple example below, Task Array Size This function returns the number of elements in each dimension of array Try the simple. example below The example finds the size of an arbitrary array. Task Auto indexing If you wire an array to a For Loop you can read and process every element in that array by. enabling auto indexing You also can enable auto indexing by configuring a For Loop to return an array of every. value generated by the loop Create a simple example in order to see the difference. Hans Petter Halvorsen Blog http home hit no hansha. Telemark University College, Department of Electrical Engineering Information Technology and Cybernetics.
LabVIEW Sub VI Example, Description Sub VIs are very useful in LabVIEW Using Sub VI helps you manage changes and debug the Block. Diagram quickly You can also easily reuse your code SubVIs are equal to functions in text based languages. Requirements LabVIEW 2009, Task Create a SubVI that performs a linear scaling Where are inputs and is an. The Procedure is as follows,Step 1 Create a New VI File New VI Blank VI. Step 2 Give the VI a Name Linear Scaling vi, Step 3 Create your Front Panel with your necessary Controls and Indicators. Step 4 Create your Block Diagram The Block Diagram could look something like this. Step 5 Create the Input and Output Connectors Right click on the little icon in the upper right corner and. select Show Connector, Faculty of Technology Postboks 203 Kj lnes ring 56 N 3901 Porsgrunn Norway Tel 47 35 57 50 00 Fax 47 35 57 54 01.
Select the Wire tool and click on the wanted connector then click on the Control or Indicator on the Front. Panel you want to connect to this connector, Step 6 Create an Icon using the Icon Editor Right click on the little icon in the upper right corner and select. Step 7 Create a new VI that you use to test your Sub VI Example. Hans Petter Halvorsen Blog http home hit no hansha. Telemark University College, Department of Electrical Engineering Information Technology and Cybernetics. LabVIEW Cluster Example, Description Clusters group data elements of mixed types such as a bundle of wires as in a telephone cable. where each wire in the cable represents a different element of the cluster A cluster is similar to a record or a. struct in text based programming languages Bundling several data elements into clusters eliminates wire. clutter on the block diagram and reduces the number of connector pane terminals that subVIs need Like an. array a cluster is either a control or an indicator A cluster cannot contain a mixture of controls and indicators. Cluster functions In the Cluster Class Variant subpalette on the Block Diagram we have the following Cluster. functions we may use to manipulate and get data in or out of a cluster In this example we will create clusters. and use these functions, Task Unbundle Unbundle By Name Use the Unbundle functions to disassemble a cluster into its individual. elements Use the Unbundle by Name function to return specific cluster elements you specify by name You. can also resize these functions for multiple elements using the mouse Create the following code. Faculty of Technology Postboks 203 Kj lnes ring 56 N 3901 Porsgrunn Norway Tel 47 35 57 50 00 Fax 47 35 57 54 01. Task Bundle Bundle By Name Use the Bundle function to assemble a cluster from individual elements To. wire elements into the Bundle function use your mouse to resize the function Create the following code. Task Cluster Order Cluster elements have a logical order unrelated to their position in the shell The first. object you place in the cluster is element 0 the second is element 1 and so on If you delete an element the. order adjusts automatically The cluster order determines the order in which the elements appear as terminals. on the Bundle and Unbundle functions on the block diagram You can view and modify the cluster order by. right clicking the cluster border and selecting Reorder Controls in Cluster from the shortcut menu. Hans Petter Halvorsen Blog http home hit no hansha. Telemark University College, Department of Electrical Engineering Information Technology and Cybernetics.
LabVIEW Formula Node Example, Description A Formula Node in LabVIEW evaluates mathematical formulas and expressions similar to C on the. block diagram In this way you may use existing C code directly inside your LabVIEW code It is also useful when. you have complex mathematical expressions,Requirements LabVIEW 2009. Task Create a simple SubVI where you use the Formula Node to calculate a slope and b intercept in the. equation when you have two points and,The Procedure is as follows. Step 1 Create a New VI File New VI Blank VI,Step 2 Give the VI a Name Linear Scaling vi. Step 3 Create your Front Panel with your necessary Controls and Indicators. Step 4 Switch to your Block Diagram Ctrl E,Step 5 Add the Formula Node to you Block Diagram.
Faculty of Technology Postboks 203 Kj lnes ring 56 N 3901 Porsgrunn Norway Tel 47 35 57 50 00 Fax 47 35 57 54 01. LabVIEW Programming Examples Hans Petter Halvorsen Telemark University College Department of Electrical Engineering Information Technology and Cybernetics Faculty of Technology Postboks 203 Kj lnes ring 56 N 3901 Porsgrunn Norway Tel 47 35 57 50 00 Fax 47 35 57 54 01 Table of Contents 1 Customizing the LabVIEW Environment 2 Wires and Variables 3 Strings 4

Related Books