• No results found

Application (EXE) Build Specification

3.12 CREATING A STAND-ALONE APPLICATION

3.12.2 Application (EXE) Build Specification

Right-click Build Specifications in the Project Explorer window and select New»Application

(EXE) from the shortcut menu.

● Modify the filename of the target and destination directory for the application in the

Application Information category.

Select the Application Information category.Change the Target filename to your filename.exe.

SUMMARY

● Modularity increases the readability and reusability of your VIs. ● A VI within another VI is called modules or subVI.

● SubVIs correspond to a subroutine in text-based programming languages.

● The upper-right corner of the front panel and block diagram displays the icon for the VI. ● After you build a VI front panel and block diagram, build the icon and the connector pane

to use the VI as a subVI.

● Right-click the icon in the upper-right corner of the front panel or block diagram and selecting

Edit Icon, you can create custom icons to replace the default icon.

Right-click the icon in the upper-right corner of the front panel and select Show Connector. ● The connector pane is a set of terminals that correspond to the controls and indicators of that VI. Define connections by assigning a front panel control or indicator to each of the connector pane terminals using the wiring tool.

Load subVIs using the Select a VI option in the All Functions palette or dragging the icon onto a new diagram.

Document a VI by selecting File»VI Properties and selecting Documentation from the

Category pull-down menu. When you move the cursor over a VI icon, the Context Help

window displays this description and indicates which terminals are required, recommended or optional.

● Add descriptions and tip strips to controls and indicators by right-clicking them and selecting

Description and Tip from the shortcut menu. When you move the cursor over controls and

indicators, the Context Help window displays this description.

Convert a section of a VI into a subVI by using the Positioning tool to select the section of the block diagram you want to reuse and by selecting Edit»Create SubVI.

LabVIEW features the Application Builder, which enables you to create stand-alone executables and installers. The Application Builder is available in the Professional

Development Systems or as an add-on package.

● Creating a professional, stand-alone application with your VIs involves understanding the following:

◆ The architecture of your application

◆ The programming issues particular to the application ◆ The application building process

◆ The installer building process

MISCELLANEOUS SOLVED PROBLEMS

Problem 3.1 Create a VI to compute full adder logic using half adder logic as subVI.

Solution The front panel and the block diagrams for the half adder is shown in Figures P3.1(a) and P3.1(b). Create a subVI called “HALF” and use this in the main VI to create a full adder as given in Figures P3.1(c) and P3.1(d).

Figure P3.1

Problem 3.2 Create a VI to find the decimal equivalent of a binary number using subVI.

Solution To find the decimal equivalent of a binary number, first create the front panel and the block diagram as given in Figures P3.2(a) and P3.2(b). Then create the subVI called “Binary to decimal” and use it in the main VI as shown in Figures P3.2(c) and P3.2(d).

Figure P3.2

Problem 3.3 Create a VI to find the Grey code equivalent of a BCD number using subVIs.

Solution Create the front panel and the block diagram as given in Figure P3.3(a) and P3.3(b). Then create the subVI called “BCD to GRAY” and use it in the main VI as shown in Figure P3.3(c) and P3.3(d).

Problem 3.4 Create a VI to find the roots of a quadratic equation using subVIs. Find both the values of the roots and the nature of the roots.

Solution Create the front panel and the block diagram as shown in Figures P3.4(a) and P3.4(b). Then create the subVI and use it in the main VI as shown in Figures P3.4(c) and P3.4(d).

Problem 3.5 Create a VI to find the average of two numbers and convert a section of a VI into a subVI.

Solution The block diagram to find the average of two numbers and convert a section of a VI into a subVI by selecting that portion is shown in Figures P3.5(a) and P3.5(b) respectively.

Figure P3.5

Problem 3.6 Create the front panel and block diagram of the Main VI to show the trigonometric values (sine, cosine and tangent) of the given degree. This VI uses a subVI for finding the trigonometric values. The SubVI consists of functions for converting degree values to radians and functions to find the sine, cosine and tangent values separately. In LabVIEW the sine, cosine and tangent functions take input in radians.

Solution Create the front panel and the block diagram as shown in Figures P3.6(a) and P3.6(b).

REVIEW QUESTIONS

1. What is modular programming? 2. Define subVI in LabVIEW?

3. Explain the need of icon and connector pane. 4. What is a default icon and a custom icon?

5. Consider an example and explain the steps involved in creating, saving and retrieving subVI? 6. Explain how to create setting required, recommended, and optional inputs and outputs in

creating terminals of a SubVI.

7. What is the difference between viewing subVIs as icons and expandable nodes? 8. How to create a subVI from the portion of an available VI?

9. How can a stand-alone application be created? 10. How can subVI be displayed as expandable nodes?

EXERCISES

1. Create a VI that takes a number representing Celsius and converts it to a number representing

Fahrenheit. Build the subVI.

2. Build a subVI of the VI that accepts a user name and password and checks for a match in a

table of information of two employees. If the name and password match, the confirmed name and a verification Boolean object are returned.

3. Create a subVI to compute the average of five students marks.

4. Given the length and breadth, build a subVI to compute the area of the polygon.

5. Build a subVI to calculate the gross salary, given the basic salary as input. The dearness

allowance is 35% of basic salary and house rent allowance is 25% of basic salary.

6. Create a subVI given two inputs x and y, and compute the complex number, its complex

conjugate and polar components.

65

4

REPETITION AND LOOPS

REPETITION AND LOOPSREPETITION AND LOOPS

REPETITION AND LOOPS

REPETITION AND LOOPS

4.1 INTRODUCTION

Loops and case statements of text-based programming languages are represented as structures in graphical programming. Repetition and loop are used to perform an action frequently with variations in the details each time. LabVIEW consists of FOR Loop and WHILE Loop. These loops are used to control repetitive operations. Structures on the block diagram are used to repeat blocks of code and to execute code conditionally or in a specific order. LabVIEW includes structures like the While Loop, For Loop, Case structure, Stacked Sequence structure, Flat Sequence structure, Event structure, and Formula Node. This chapter introduces the loops in LabVIEW, iterative data transfer in loops and timing a loop along with functions commonly used with these structures, including the shift register and the Feedback Node.