Looking for:
Labview core 2 course manual pdf free download.LabVIEW Core1 Course ManualLabVIEW Resources – WKU LabVIEW Academy - Recommended
Labview core 2 course manual pdf free download. LabVIEW Resources
Using the Positioning Tool to Select an Object uti ts ri b e n on i st um r D str If the mouse hovers over a resizing node of an object, the cursor mode changes to show that you t fo l I n can resize the object, as shown in Figure Notice that the cursor is hovering over a corner of the XY Graph at a resizing node, and the cursor mode changes to a double-sided arrow. Use the Labeling tool to enter text in a control, to edit text, and to create free labels.
For example, in Figure the Labeling tool enters text in the Number of Measurements numeric control. When uti ts the mouse hovers over the interior of the control, the cursor automatically accesses the Labeling tool. Click once to place a cursor inside the control.
Then double-click to select the current text. Using the Labeling Tool i st um r D str t fo l I n No na When you are not in a specific area of a front panel window or block diagram window that accesses a certain mouse mode, the cursor appears as cross-hairs. If automatic tool selection is enabled, you ti o can double-click any open space to access the Labeling tool and create a free label.
Wiring Tool When the mouse cursor changes to the icon shown below, the Wiring tool is in operation. Use the Na Wiring tool to wire objects together on the block diagram.
For example, in Figure the Wiring tool wires the Number of Measurements terminal to the count terminal of the For Loop. When the mouse hovers over the exit or entry point of a terminal or over a wire, the cursor automatically accesses the Wiring tool. Using the Wiring Tool uti ts ri b e n on i st um r D str The Wiring tool works mainly with the block diagram window and when you create a connector pane on the front panel window.
Other Tools Accessed from the Palette t fo l I n You can access the Operating, Positioning, Labeling, and Wiring tools directly from the Tools palette, rather than using the Automatic tool selection mode.
Select View»Tools Palette to access the Tools palette. You can turn off automatic tool selection by deselecting the item, or by selecting another item in the palette. Use the Probe tool to check intermediate values in a VI that produces questionable or unexpected results.
The Coloring tool also displays the current foreground and background color settings. No na Select the Coloring tool and right-click an object or workspace to display the color picker. A block diagram node executes when it Na receives all required inputs. When a node executes, it produces output data and passes the data to the next node in the dataflow path. The movement of data through the nodes determines the execution order of the VIs and functions on the block diagram.
In control flow, the sequential order of program elements determines the execution order of a program. In this case, the block diagram executes from left to right, not because the objects are placed in that order, but because the Subtract function cannot execute until the Add function finishes executing and passes the data to uti ts the Subtract function.
Remember that a node executes only when data are available at all of its input terminals and supplies data to the output terminals only when the node finishes execution.
Dataflow Programming Example ri b e n on i st um In Figure , consider which code segment would execute first—the Add, Random Number, or Divide function. You cannot know because inputs to the Add and Divide functions are available at the same time, and the Random Number function has no inputs. In a situation where one code segment must execute before another, and no data dependency exists between the functions, use r D str other programming methods, such as error clusters, to force the order of execution.
Refer to Lesson 5, Creating and Leveraging Data Structures, for more information about error clusters. When each of these parts are simple, you can complete the entire VI using very few objects on the block diagram.
Express VIs are designed specifically for Na completing common, frequently used operations. In this section, you learn about some Express VIs that acquire, analyze, and present data. Then you learn to create a simple VI that uses these three tasks, as shown in Figure You must use this Express VI frequently throughout this course. Until you learn more about data acquisition, you only use one channel of the data acquisition device, CH0.
This channel is connected to a temperature sensor on uti ts the BNC You can touch the temperature sensor to change the temperature the sensor reads. These include DC, rms, maximum peak, minimum peak, peak to peak, cycle average, and cycle rms measurements.
This includes mean, sum, standard deviation, and extreme values. It also finds the frequency and amplitude of a single tone. Refer to Lesson 6, Managing File and Hardware Resources, for more information on writing to measurement files. Refer to Lesson 6, Managing File and Hardware Resources, for i st um more information on creating strings. After the execution completes, the Run button icon changes back to its original state, and the front panel indicators contain data.
The Run button appears broken when the VI you are creating or editing contains errors. Na If the button still appears broken when you finish wiring the block diagram, the VI is broken and cannot run. Generally, this means that a required input is not wired, or a wire is broken. Press the broken run button to access the Error list window. The Error list window lists each error and describes the problem. You can double-click an error to go directly to the error. Dataflow Questions ri b e n on i st um 1.
Which function executes first: Add or Subtract? Subtract c. Unknown 2. Which function executes first: Sine or Divide? Sine b. Divide c. Unknown 3. Which function executes first: Random Number, Divide or Add? No na a. Random Number b. Add d. Unknown ti o 4. Which function executes last: Random Number, Subtract or Add? Subtract Na c. Unknown 5. What are the three parts of a VI? Front panel window b.
Block diagram window c. Project d. Add b. Subtract r D str c. Which function executes first? Divide No na c. Unknown 4. Which function executes last: Random, Subtract or Add? Unknown Na 5. Sometimes a VI produces data or runs in a way you do not expect. You can use LabVIEW to configure how a VI runs and to identify problems with block diagram organization on or with the data passing through the block diagram.
Correcting Broken VIs B. Debugging Techniques C. Undefined or Unexpected Data r D str D. They are designed to help you avoid potential problems in VIs. Errors, however, can break a VI. You must resolve any errors before you can run the VI. The Error list window lists all the errors. The Items with errors section lists the names of all items in r D str memory, such as VIs and project libraries that have errors. If two or more items have the same name, this section shows the specific application instance for each item.
The errors and warnings section lists the errors and warnings for the VI you select in the Items with errors section. The Details section describes the errors and in some cases recommends how to correct the errors. Click the Help button to display a topic in the LabVIEW Help that describes the error in detail and t fo l I n includes step-by-step instructions for correcting the error.
Click the Show Error button or double-click the error description to highlight the area on the block diagram or front panel that contains the error. These parameters detect errors encountered in each node on the block diagram and indicate if and where an error occurred. You also can use these parameters in the VIs you build. Determine the causes and correct them in t fo l I n the VI. VIs and functions pass default values if recommended or optional inputs are No na unwired.
Unlike unwired functions, unwired VIs do not always generate errors unless you configure an input to be required. If you mistakenly place an unwired subVI on the block diagram, it executes when the block diagram does.
Consequently, the VI might perform extra actions. This feature allows you to easily check values of data that last passed through any wire.
This often happens with numbers. For example, at one point in the VI an operation could have divided a number by zero, uti ts thus returning Inf infinity , whereas subsequent functions or subVIs were expecting numbers.
Also, close subVI front panels and block diagrams when you are not using them because open windows can affect execution speed. For i st um example, you might wire a bit integer to a function that only accepts 8-bit integers. This causes the function to convert the bit integer to an 8-bit representation, potentially causing a loss of data. LabVIEW detects data type and cluster size mismatches at edit time, but it does not detect mismatches of elements of the same type.
You inadvertently might have hidden a subVI by placing one directly on top of another node or by decreasing the size of a structure without keeping the subVI in view. To help avoid incorrect results caused by hidden VIs, specify that inputs to VIs are required. Na Execution highlighting shows the movement of data on the block diagram from one node to another using bubbles that move along the wires. Use execution highlighting in conjunction with single-stepping to see how data values move from node to node through a VI.
The single-stepping buttons, shown as follows, affect execution only in a VI or subVI in single-step mode. No na Enter single-step mode by clicking the Step Into or Step Over button on the block diagram toolbar. Move the cursor over the Step Into, Step Over, or Step Out button to view a tip strip that ti o describes the next step if you click that button. You can single-step through subVIs or run them normally. When you single-step through a VI, nodes blink to indicate they are ready to execute.
If you single-step through a VI with execution highlighting on, an execution glyph appears on the icons Na of the subVIs that are currently running. Use the Probe tool with execution highlighting, single-stepping, and breakpoints to determine if and where data is incorrect.
If data is available, the probe on immediately updates and displays the data in the Probe Watch Window during execution highlighting, single-stepping, or when you pause at a breakpoint. When execution pauses at a node because of single-stepping or a breakpoint, you also can probe the wire that just executed to see the i st um value that flowed through that wire.
Tip If you want a probe to display the data that flowed through the wire during the last VI execution, click the Retain Wire Values button on the block diagram toolbar. Generic No na Use the generic probe to view the data that passes through a wire.
Right-click a wire and select Custom Probe»Generic Probe from the shortcut menu to use the generic probe. The generic probe displays the data. You cannot configure the generic probe to respond to the data. You can debug a custom probe similar to a VI. However, a probe cannot probe its own block diagram, nor the block diagram of any of its subVIs. When debugging probes, use the generic Na probe.
Using Indicators to View Data You also can use an indicator to view the data that passes through a wire. For example, if you view numeric data, you can use a chart within the probe to view the data.
Right-click a wire, select Custom Probe»Controls from the shortcut menu, and select the indicator you want to use. You also can click the Select a Control icon on the Controls palette and select any custom control or ni.
LabVIEW treats type definitions as custom controls when you use them to view probed data. If the data type of the indicator you select does not match the data type of the wire you uti ts right-clicked, LabVIEW does not place the indicator on the wire. Supplied ri b e n Supplied probes are VIs that display comprehensive information about the data that passes through a wire. You also can use a supplied probe to respond based on the data that flows through the wire.
For example, use an Error probe on an error cluster to receive the status, code, source, and description of the error and specify if you want to set a conditional breakpoint if i st um an error or warning occurs. The supplied probes appear at the top of the Custom Probe shortcut menu. Right-click a wire and select Custom Probe from the shortcut menu to select a supplied probe. Only probes that match the data type of the wire you right-click appear on the shortcut menu.
Custom t fo l I n Use the Create New Probe dialog box to create a probe based on an existing probe or to create a new probe. Create a probe when you want to have more control over how LabVIEW probes the data that flows through a wire. When you create a new probe, the data type of the probe matches the data type of the wire you right-clicked.
If you want to edit the probe you No na created, you must open it from the directory where you saved it. After you select a probe from the Custom Probe shortcut menu, navigate to it using the Select a Control palette option, or create a new probe using the Create New Probe dialog box, that probe becomes the default probe for that data type, and LabVIEW loads that probe when you right-click ti o a wire and select Probe from the shortcut menu.
LabVIEW only loads probes that exactly match the data type of the wire you right-click. That is, a double precision floating-point numeric probe cannot probe a bit unsigned integer wire even though LabVIEW can convert the data. Na Note If you want a custom probe to be the default probe for a particular data type, save the probe in the user.
Do not save probes in the vi. Place a breakpoint on the block diagram to pause execution after all on nodes on the block diagram execute. The block diagram border appears red and blinks to reflect the placement of a breakpoint. When you move the cursor over an existing breakpoint, the black area of the Breakpoint tool cursor appears white. When you reach a breakpoint during execution, the VI pauses and the Pause button appears red. Suspending Execution Suspend execution of a subVI to edit values of controls and indicators, to control the number of No na times the subVI runs before returning to the caller, or to go back to the beginning of the execution of the subVI.
You can cause all calls to a subVI to start with execution suspended, or you can suspend a specific call to a subVI. The subVI automatically suspends when another VI calls it. If you select this menu item when single-stepping, the subVI does not suspend immediately.
The subVI suspends when it is called. Place a checkmark in the Suspend when called checkbox to suspend execution only at that instance of the subVI. An arrow glyph indicates a VI that is running regularly or single-stepping. Use the Call list menu to determine the current instance of the subVI if the block diagram contains more than one instance.
LabVIEW does not check for overflow or underflow conditions on integer values. Floating-point operations propagate NaN and Inf reliably. When you explicitly or implicitly convert NaN or Inf to integers or Boolean values, the values become meaningless.
For example, dividing 1 by zero produces Inf. Converting Inf to a bit integer produces the value 32,, which appears to be a normal value. Instead, confirm that the VI produces defined data by making the VI report an error if it encounters a situation that is likely to produce undefined data.
Either produce an output error code, on substitute defined data for the value that the loop creates, or use a Case structure that does not execute the For Loop if the array is empty. Error Handling No matter how confident you are in the VI you create, you cannot predict every problem a user can encounter.
Without a mechanism to check for errors, you know only that the VI does not work properly. Error checking tells you why and where errors occur. With error handling you quickly pinpoint the source of programming errors. Without it, you might observe t fo l I n unexpected behavior but struggle to find the source of the problem.
Error handling is also extremely valuable when you test your application to ensure that your error reporting is meaningful and that the error handling code safely stops your application when an error occurs. For example, during stress testing you are setting values or conditions that are beyond the normal operational capacity of your application which often result in errors. When such errors occur, you want to ensure proper shutdown of your application.
No na Error handling continues to be important after an application is deployed. Error handling can help detect system and environment differences—such as differences in file systems, memory, and disk resources.
National Instruments strongly recommends using error handling. In Na the error dialog box, each error has a numeric code to identify it and a corresponding error message to display to the user. To disable automatic error handling for any new, blank VIs you create, select Tools»Options and select Block Diagram from the Category list. To disable automatic error handling for a subVI or function within a VI, wire its error out parameter to the error in parameter of another subVI or function or to an error out indicator.
You also might want the VI to retry for a certain period of time. For example, if LabVIEW encounters an error, you can display the on error message in different kinds of dialog boxes. For example, when an error is detected you can fix the error programmatically and then wire the error out output of the VI or function to the error in input of the Clear Errors VI.
Tip Use error handling in conjunction with the debugging tools to find and manage errors. Typically, functions use numeric error codes, and VIs use an error cluster, usually with error t fo l I n inputs and outputs.
Use the error cluster controls and indicators to create error inputs and outputs in subVIs. Tip All error clusters on a block diagram typically provide the same standard error in and standard error out functionality. If LabVIEW detects an error, the node passes the error to the next node without executing that part of the code. Although most errors have negative code values and warnings have positive code values, this is not universally true.
Therefore you should rely on both the status value and the code value to detect uti ts errors and warnings. Warnings are typically considered less severe than errors. Even though code executes normally, it is important that you monitor warnings during development to i st um ensure proper behavior of your application. Explain Error Dialog Box When an error occurs, right-click within the cluster border and select Explain Error from the shortcut menu to open the Explain Error dialog box.
The Explain Error dialog box contains r D str information about the error. The shortcut menu includes an Explain Warning option if the VI contains warnings but no errors. Just as data values flow through a VI, so can error information. To implement good error handling, you must determine the actions to take when an error occurs at No na any point in your application. To begin with, you must utilize the error terminals on functions and VIs. Since the error cluster is implemented as a flow-through parameter, you should propagate errors by wiring the error out cluster of the first node you want to execute to the error in cluster of the next node you want to execute.
You must continue to do this for sequences of nodes. Any subVIs that you create should also implement this flow-through behavior.
Refer to Figure for proper use of the shift-register to propagate errors and uti ts warnings to successive loop iterations. Refer to Figure for an example of merging error information from parallel node sequences. Merge Errors From Multiple Sources t fo l I n No na At the end of your application after all error sources are merged into one error cluster, you must report errors to the user using the Simple Error Handler VI or another error reporting mechanism.
This is useful if you want to have programmatic control Na over handling errors. After the user acknowledges the dialog box, the VI returns control to the main VI. If the user selects Stop, the VI calls the Stop function to halt execution. If the user selects Stop, the VI calls the Stop function to uti ts halt execution. Each product or group of VIs on defines a range of error codes.
You can define custom error codes in the range of — through —, through , or , through , Some numeric error codes are used by more than one group of VIs and functions. For example, r D str error 65 is both a serial error code, indicating a serial port timeout, and a networking error code, indicating that a network connection is already established.
Which of the following will result in a broken run arrow? A subVI is broken b. The diagram includes a divide by zero c. A required subVI input is unwired ri b e n d. A Boolean terminal is wired to a numeric indicator on i st um 2. Which of the following are the components and data types of the error cluster?
Status: Boolean b. Error: String c. Code: bit integer r D str d. Source: String 3. All errors have negative error codes and all warnings have positive error codes. True b. False No na 4. Merge Errors function concatenates error information from multiple sources. Which of the following are the contents of the error cluster?
These skills include designing a user ri b e n interface, choosing a data type, documenting your code, using looping structures such as While Loops and For Loops, adding software timing to your code, displaying your data as a plot, and on making decisions in your code using a Case structure. Front Panel Basics B. Documenting Code r D str D. While Loops E.
For Loops F. Timing a VI G. Data Feedback in Loops t fo l I n H. Plotting Data — Waveform Chart I. Front Panel Basics In the design phase of the software development method, you identify the inputs and outputs of the problem. This identification leads directly to the design of the front panel window.
You can display the outputs of the problem with indicators, such as graphs, charts, or LEDs, or log the outputs to a file. You also can output data to a device using signal generation.
Designing Controls and Indicators r D str When choosing controls and indicators, make sure that they are appropriate for the task you want to perform.
For example, when you want to determine the frequency of a sine wave, choose a dial control, or when you want to display temperature, choose a thermometer indicator. These labels help users identify the purpose of each control and indicator.
Also, clear labeling helps you document your code on the block diagram. Control and indicator labels correspond to the names of terminals on the block diagram, as shown in Figure No na Figure By setting a default value, you can assume a reasonable value for a VI if the user does not set another value during run-time.
Enter the desired value. Other data types include the enumerated data type, dynamic data, and others. Even within numeric data types, there are different data types, such as whole numbers or fractional numbers. For example, in Figure , Height cm is a double-precision, floating-point numeric. This is indicated by the color of the terminal, orange, and by the text shown uti ts on the terminal, DBL.
Terminal Data Type Example ri b e n on i st um Tip Terminal names correspond to the labels of the controls and indicators on the front panel.
Right-click a terminal and select Find control or Find indicator from the shortcut r D strmenu to locate the control or indicator on the front panel. As you create a VI, use the shortcut menu items to change the t fo l I n appearance or behavior of front panel and block diagram objects. To access the shortcut menu, right-click the object. Figure shows a shortcut menu for a control and terminal. Right-click an object and select Properties from the shortcut menu to access the property dialog box for an object.
Figure shows the property dialog box for the Height cm terminal uti ts shown in Figure The options available on the property dialog box for an object are similar to the options available on the shortcut menu for that object. Property Dialog Box for a Numeric Terminal on i st um r D str t fo l I n No na You can select multiple objects on the front panel or the block diagram and edit any properties the objects share.
Right-click an object from the selection and select Properties from the shortcut menu to display the Properties dialog box. The Properties dialog box only displays tabs and properties that the objects you select share. Select similar objects to display more tabs and properties.
If you select objects that do not share any common properties, the Properties dialog box does not display any Na tabs or properties. To change the representation type of a number, right-click the control, indicator, or constant, and select Representation, as shown in Figure Numeric Representation ri b e n on i st um r D str t fo l I n No na ti o When you wire two or more numeric inputs of different representations to a function, the function usually returns the data in the larger, or wider, representation.
The functions coerce the smaller representations to the widest representation before execution. LabVIEW places a coercion dot on the terminal where the conversion takes place. Refer to Numeric Conversion for more information. Na The numeric data type includes the following subcategories of representation—floating-point numbers, signed integers, unsigned integers, and complex numbers.
Use single-precision, floating-point numbers when memory savings are important and you will not overflow the range of the numbers ri b e n Double-precision DBL —Double-precision, floating-point numbers have bit IEEE on double-precision format. Double-precision is the default format for numeric objects. For most situations, use double-precision, floating-point numbers i st um Extended-precision EXT —When you save extended-precision numbers to disk, LabVIEW stores them in a platform-independent bit format.
In memory, the size and precision vary depending on the platform. Use extended-precision, floating-point numbers only when necessary. The performance of extended-precision arithmetic vary among platforms. Unlike the floating-point data type, which allows the total number of bits LabVIEW uses to represent numbers to vary, you can configure fixed-point numbers to always use t fo l I n a specific number of bits.
Hardware and targets that only can store and process data with a limited or fixed number of bits then can store and process the numbers. You can specify the range and precision of fixed-point numbers. Note To represent a rational number using the fixed-point data type, the denominator of the rational number must be a power of 2, because the binary number system is a No na base-2 number system.
Use the fixed-point data type when you do not need the dynamic functionality of floating-point representation or when you want to work with a target that does not support floating-point ti o arithmetic, such as an FPGA target. Specify the encoding, word length, and integer word length of a fixed-point number when you want the number to conform to a certain bit size.
Encoding—The binary encoding of the fixed-point number. You can select signed or unsigned. If Na you select signed, the sign bit is always the first bit in the bit string that represents the data. Word length—The total number of bits in the bit string that LabVIEW uses to represent all possible values of the fixed-point data. LabVIEW accepts a maximum word length of 64 bits. Certain targets might limit data to smaller word lengths. If you open a VI on a target and the VI contains fixed-point data with larger word lengths than the target can accept, the VI contains broken wires.
Refer to the documentation for a target to determine the maximum word length the target accepts. The integer word length can be larger than the word length, and can be positive or negative. Signed integers can be positive or negative. Use the unsigned ri b e n integer data types when you know the integer is always positive. If the value of the input is midway between two integers, the function returns the nearest i st um even integer.
Byte I8 —Byte integer numbers have 8 bits of storage and a range of — to Word I16 —Word integer numbers have 16 bits of storage and a range of —32, to 32, In most cases, it is best to use a bit integer. Quad I64 —Quad integer numbers have 64 bits of storage and a range of —1e19 to 1e Word U16 —Word unsigned integer numbers have 16 bits of storage and a range of 0 to 65, Long U32 —Long unsigned integer numbers have 32 bits of storage and a range of 0 to 4,,, No na Quad U64 —Quad unsigned integer numbers have 64 bits of storage and a range of 0 to 2e Complex Numbers ti o Complex numbers are concatenated versions of floating-point numbers with a real and an imaginary part.
In LabVIEW, because complex numbers are a type of floating-point number, complex numbers are also represented with the color orange. There are three types of complex numbers. In memory, the size and precision of extended-precision numbers vary depending on the platform. Normally, when you wire different representation types to the inputs of a function, the function returns an output in the larger or wider format. If you use a signed uti ts integer with an unsigned integer, it will coerce to the unsigned integer.
If you use an unsigned integer with a floating point, it will coerce to the floating point. If you use a floating point number with a complex number, it will coerce to the complex number. If you use two numbers of the same ri b e n type with different bit widths, LabVIEW will coerce to the larger of the two bit widths. LabVIEW coerces the bit signed integer because it uses fewer bits than the double-precision, i st um floating-point numeric value.
The lower input of the Multiply function shows a red dot, called a coercion dot, that indicates LabVIEW coerced the data. Any nonzero value represents TRUE.
No na Boolean values also have a mechanical action associated with them. The two major actions are latch and switch. The frequency with which the VI reads the control does not affect this behavior. At this time, the control reverts to its default value, similar to the operation of a door buzzer. You cannot select this behavior for a radio buttons control. At this point, the control reverts to its default value even if you keep pressing the mouse button.
This behavior is similar to a circuit breaker and is useful for stopping a While Loop or for getting the VI to perform an action only once each time you set the control. When the VI reads it once, the control reverts to its default value.
This behavior works in the same manner as dialog box buttons and system buttons. Strings provide a platform-independent format for information and data. To store numeric data in an ASCII file, you must first convert numeric data to strings before writing the data to a disk file. LabVIEW includes built-in VIs and functions you can use to manipulate strings, including formatting strings, parsing strings, and other editing.
The table also shows an example message in each display type. Non-displayable characters r D str generally appear as boxes. An enum represents a pair of values, a string and a numeric, where the enum can be one of a list of values. For example, if you created an enum type called Month, the possible value pairs for a Month uti ts variable are January-0, February-1, and so on through December Figure shows an example of these data pairs in the Properties dialog box for an enumerated control.
Figure shows the Month enumerated control, the selection of a data pair in the enumerated control, and the corresponding block diagram terminal. The dynamic data type appears as a dark blue terminal, shown below.
You can wire the dynamic data type to any indicator or input that accepts numeric, waveform, or Boolean data. Wire the dynamic data type to an indicator that can No na best present the data.
Indicators include graphs, charts, or numeric indicators. To use a built-in VI or function to analyze or process the data the dynamic data type includes, you must convert the dynamic data type.
Documenting Code ri b e n Professional developers who maintain and modify VIs know the value of good documentation. Document the block diagram well to ease future modification of the code.
In addition, document on the front panel window well to explain the purpose of the VI and the front panel objects. Use tip strips, descriptions, VI Properties, and good design to document front panel windows.
For example, you might add a tip strip to indicate that a temperature is in degrees Celsius or explain how an input works in an algorithm. Descriptions provide additional information r D str about specific controls and indicators. Descriptions appear in the Context Help window when you move the cursor over the object. To add tip strips and descriptions to controls, right-click the control or indicator and select Description and Tip from the shortcut menu.
Then select Documentation from the Categories drop-down menu. No na You cannot access this dialog box while a VI runs. You also can use the Help:Document Tag property to set the help tag Na programmatically. If this field is empty, the Detailed help link does not appear in the Context Help window, and the Detailed help button is dimmed. For example, if you name a control Temperature, a user may not know which units to use.
You now know to uti ts enter temperatures in metric units. Graphical Programming ri b e n While the graphical nature of LabVIEW aids in self-documentation of block diagrams, extra on comments are helpful when modifying your VIs in the future.
There are two types of block diagram comments—comments that describe the function or operation of algorithms and comments that i st um explain the purpose of data that passes through wires. Both types of comments are shown in the following block diagram. You can insert standard labels with the Labeling tool, or by inserting a free label from the Functions»Programming»Structures»Decorations subpalette. By default, free labels have a yellow background color. LabVIEW includes two different types of labels—owned labels and free labels.
Owned labels belong to and move with a particular object and annotate that object only. Free labels are not attached to any object, and Na you can create, move, rotate or delete them independently. A developer looking at the block diagram can find the name of a function or subVI by using the Context Help window.
Labeling wires is useful for wires coming from shift registers and for long wires that span the entire block diagram. Refer to the Case Structures section of this lesson for more information about shift registers.
If you use an algorithm from a book or other reference, provide the reference information. While Loops Similar to a Do Loop or a Repeat-Until Loop in text-based programming languages, a While Loop, ri b e n shown in Figure , executes a subdiagram until a condition occurs. Select the While Loop from the palette then use the cursor to drag a selection rectangle around the section of the block diagram you want to repeat. When you release the mouse button, a While Loop boundary encloses the section you No na selected.
Add block diagram objects to the While Loop by dragging and dropping them inside the While Loop. The While Loop executes the subdiagram until the conditional terminal, an input terminal, receives a specific Boolean value. However, the While Loop does not include a set iteration count and runs Na infinitely if the condition never occurs. If a conditional terminal is Stop if True, you place the terminal of a Boolean control outside a While Loop, and the control is FALSE when the loop starts, you cause an infinite loop, as shown in the following example.
You also cause an infinite loop if the conditional terminal is Continue if True and the control outside the loop is set to TRUE, as shown in Figure An Infinite Loop uti ts ri b e n on Changing the value of the control does not stop the infinite loop because the value is only read i st um once, before the loop starts. To stop an infinite loop, you must abort the VI by clicking the Abort Execution button on the toolbar. You also can perform basic error handling using the conditional terminal of a While Loop.
When you wire an error cluster to the conditional terminal, only the True or False value of the status parameter of the error cluster passes to the terminal. The iteration terminal is an output terminal that contains the number of completed iterations. In the following block diagram, the While Loop executes until the Random Number function output is greater than or equal to 0. The And function returns True only if both inputs are True.
Otherwise, it returns False. No na In the following example, there is an increased probability of an infinite loop. Generally, the desired behavior is to have one condition met to stop the loop, rather than requiring both conditions to be met.
The tunnel appears as a solid block on the border of the While Loop. The block is the color of the data type wired to the tunnel. Data pass out of a loop after the loop terminates.
When a tunnel passes data into a loop, the loop executes uti ts only after data arrive at the tunnel. In the following block diagram, the iteration terminal is connected to a tunnel.
The value in the ri b e n tunnel does not get passed to the Iterations indicator until the While Loop finishes executing. While Loop Tunnel i st um r D str Only the last value of the iteration terminal displays in the Iterations indicator. If an error occurs, the loop stops.
No na If you wire an error cluster to the conditional terminal, the shortcut menu items Stop if True and Continue if True change to Stop on Error and Continue while Error. In Figure , the error cluster and a stop button are used together to determine when to stop the loop.
This is the recommended method for stopping most loops. Stopping a While Loop Na ni. For Loops A For Loop, shown as follows, executes a subdiagram a set number of times. The count terminal is an input terminal whose value indicates how many times to repeat the subdiagram.
No na The iteration count for the For Loop always starts at zero. A For Loop with a conditional terminal executes until the condition occurs or until all iterations are complete, whichever happens first. For Loops you configure for a uti ts conditional exit have a red glyph in the count terminal as well as a conditional terminal in the lower right corner.
After you configure the For Loop to exit conditionally, the loop appears similar to Figure The following For Loop generates a random number every second until seconds ri b e n has passed or the user clicks the stop button. Then wire the conditional terminal and the count terminal.
The For Loop executes until an error occurs or until the number of set iterations completes. Numeric Conversion in For Loops ri b e n As noted in Numeric Conversion, when you wire different data types to the input of a function, the on function generally returns the larger or wider data type.
However, if you wire a double-precision, floating-point numeric value to the bit count terminal on a For Loop, LabVIEW coerces the i st um larger numeric value to a smaller bit signed integer. Although the conversion is contrary to normal conversion standards, it is necessary, because a For Loop can only execute an integer number of times.
Coercion on a For Loop r D str 1 t fo l I n 1 Coercion Dot For better performance, avoid coercion by using matching data types or programmatically No na converting to matching data types, as shown in Figure Comparing For Loops and While Loops For Loop While Loop ri b e n Executes a set number of times unless a Stops executing only if the value at the conditional terminal is added conditional terminal meets the condition on Can execute zero times Must execute at least once i st um Tunnels automatically output an array of data Tunnels automatically output the last value F.
Timing a VI When a loop finishes executing an iteration, it immediately begins executing the next iteration, r D str unless it reaches a stop condition. Most often, you need to control the iteration frequency or timing. For example, if you are acquiring data, and you want to acquire the data once every 10 seconds, you need a way to time the loop iterations so they occur once every 10 seconds.
Even if you do not need the execution to occur at a certain frequency, you need to provide the t fo l I n processor with time to complete other tasks, such as responding to the user interface. This section introduces some methods for timing your loops. Wait Functions Place a wait function inside a loop to allow a VI to sleep for a set amount of time. This allows your No na processor to address other tasks during the wait time.
Wait functions use the millisecond clock of the operating system. The Wait Until Next ms Multiple function monitors a millisecond counter and waits until the ti o millisecond counter reaches a multiple of the amount you specify. Use this function to synchronize activities. Place this function in a loop to control the loop execution rate. For this function to be effective, your code execution time must be less than the time specified for this function. The execution rate for the first iteration of the loop is indeterminate.
Na The Wait ms function waits until the millisecond counter counts to an amount equal to the input you specify. This function guarantees that the loop execution rate is at least the amount of the input you specify.
The ri b e n Elapsed Time Express VI indicates the amount of time that elapses after the specified start time. This Express VI does not provide the processor with time to complete other tasks. For example, if you are acquiring one piece of data in each iteration of a loop and must average every five pieces of data, you must retain the data from previous iterations of the loop.
Note Feedback Nodes are another method for retaining information from a previous t fo l I n iteration. Shift Registers No na Shift registers are similar to static variables in text-based programming languages. Use shift registers when you want to pass values from previous iterations through the loop to the next iteration. A shift register appears as a pair of terminals directly opposite each other on the vertical sides of the loop border.
After the loop executes, the terminal on the right side of the loop returns the last value stored in the shift register. Create a shift register by right-clicking the left or right border of a loop and selecting Add Shift Register from the shortcut menu. A shift register transfers any data type and automatically changes to the data type of the first object wired to the shift register.
The data you wire to the terminals of each shift register must be the same type. If you have multiple operations that use previous iteration values within your loop, use multiple shift registers to store the data values from those different processes in the structure, as shown in the following figure. Using Multiple Shift Registers ri b e n on i st um Initializing Shift Registers Initializing a shift register resets the value the shift register passes to the first iteration of the loop when the VI runs.
Initialize a shift register by wiring a control or constant to the shift register r D str terminal on the left side of the loop, as shown in Figure Initialized Shift Register t fo l I n No na In Figure , the For Loop executes five times, incrementing the value the shift register carries by one each time.
After five iterations of the For Loop, the shift register passes the final value, 5, to the indicator and the VI quits. Each time you run the VI, the shift register begins with a value of 0. Use an uninitialized shift register to preserve state information between subsequent executions of a VI. Figure shows an uninitialized shift register. Na Figure Uninitialized Shift Register ni. The first time you run the VI, the shift register begins with a value of 0, which is the default value for a bit integer.
After five iterations of the For Loop, the shift register passes the final value, 5, to the indicator, and the VI quits. The next time you run the VI, the shift register uti ts begins with a value of 5, which was the last value from the previous execution. After five iterations of the For Loop, the shift register passes the final value, 10, to the indicator. If you run the VI again, the shift register begins with a value of 10, and so on. Uninitialized shift registers retain the value ri b e n of the previous iteration until you close the VI.
Stacked shift registers i st um remember values from multiple previous iterations and carry those values to the next iterations. To create a stacked shift register, right-click the left terminal and select Add Element from the shortcut menu.
Stacked shift registers can occur only on the left side of the loop because the right terminal transfers the data generated from only the current iteration to the next iteration, as shown in Figure Using Stacked Shift Registers t fo l I n No na If you add another element to the left terminal in the previous block diagram, values from the last two iterations carry over to the next iteration, with the most recent iteration value stored in the top shift register.
The bottom terminal stores the data passed to it from the previous iteration. Plotting Data — Waveform Chart The waveform chart is a special type of numeric indicator that displays one or more plots of data typically acquired at a constant rate.
Waveform charts can display single or multiple plots. Two plots are displayed: Raw Data and Running Avg. Right-click the chart and select Advanced» No na Update Mode from the shortcut menu to set the chart update mode. A strip chart is similar to a paper tape strip ti o chart recorder. Strip Chart is the default update mode.
For each new value, the chart plots the value to the right of the last value. When the plot reaches the right border of the plotting area, LabVIEW erases the plot and Na begins plotting again from the left border.
The retracing display of a scope chart is similar to an oscilloscope. LabVIEW does not erase the plot in a sweep chart when the plot reaches the right border of the plotting area. A sweep chart is similar to an EKG display. The scope chart and sweep chart have retracing displays similar to an oscilloscope. Because retracing a plot requires less overhead, the scope chart and the sweep chart display plots significantly faster than the strip chart.
Chart Update Modes ri b e n on i st um Wiring Charts You can wire a scalar output directly to a waveform chart. The waveform chart terminal shown in Figure matches the input data type. In Figure , the Bundle function bundles the outputs of the three VIs to plot on the waveform chart.
To add more plots, use the Positioning tool to resize the Bundle function. Case Structures A Case structure has two or more subdiagrams, or cases. An on input value determines which subdiagram executes. The Case structure is similar to switch statements or if Click the decrement and increment arrows to scroll through the available cases.
You also can click r D str the down arrow next to the case name and select a case from the pull-down menu. Wire an input value, or selector, to the selector terminal to determine which case executes.
You can position the selector terminal anywhere on the left border of the Case structure. If the data type of the selector terminal is Boolean, the structure has a True case and a False case. If the selector terminal is an integer, string, or enumerated type value, the structure can have any number of cases. No na Note By default, string values you wire to the selector terminal are case sensitive. To allow case-insensitive matches, wire a string value to the selector terminal, right-click the border of the Case structure, and select Case Insensitive Match from the shortcut menu.
For example, if the selector is an integer and you specify cases for 1, 2, and 3, you must specify a default case to execute if the input value is 4 or any other Na unspecified integer value. Note You cannot specify a default case if you wire a Boolean control to the selector. If you right-click the case selector label, Make This The Default Case does not appear in the shortcut menu. To convert a Case structure to a Stacked Sequence structure, right-click the Case structure and select Replace with Stacked Sequence from the shortcut menu.
The top block diagram shows the True case in the ri b e n foreground. In the middle block diagram, the False case is selected. To select a case, enter the value in the case selector identifier or use the Labeling tool to edit the values.
After you select another case, that case displays on the block diagram, as shown in the bottom block diagram of Figure Changing the Case View of a Case Structure i st um r D str t fo l I n No na ti o If you enter a selector value that is not the same type as the object wired to the selector terminal, the value appears red.
This indicates that the VI will not run until you delete or edit the value. Also, because of the possible round-off error inherent in floating-point arithmetic, you cannot use floating-point numbers as case selector values. If you type a floating-point value in the case Na selector label, the value appears red to indicate that you must delete or edit the value before the structure can execute. Inputs are available to all cases, but cases do not need to use each input. However, you must define an output tunnel for each case.
LabVIEW indicates this error by ri b e n leaving the center of the tunnel white. The unwired case might not be the case that is currently visible on the block diagram. You also can right-click the output tunnel and select Use Default If Unwired i st um from the shortcut menu to use the default value for the tunnel data type for all unwired tunnels. When the output is wired in all cases, the output tunnel is a solid color.
Embed Size px. Start on. Show related SlideShares at end. WordPress Shortcode. Like Liked. Rebecca Luna. Full Name Comment goes here. Are you sure you want to Yes No. Be the first to like this. No Downloads. Views Total views. Actions Shares. No notes for slide. Labview coremanual 1. Or maybe should you actually pin point a precise subject, make sure you utilize the Glossary page to simply locate the area of interest you are interested in, since it arrange alphabetically.
You just clipped your first slide! Clipping is a handy way to collect important slides you want to go back to later.
Comments
Post a Comment