how to make a simple calculator in labview™ · 8 how to make a simple calculator in labview™...

55
How to Make a Simple Calculator in LabVIEW™ Lita Wilch TECM 2700.022 4/28/2013

Upload: others

Post on 30-Apr-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

How to Make a Simple Calculator in LabVIEW™

Lita Wilch

TECM 2700.022

4/28/2013

Page 2: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

2 How to Make a Simple Calculator in LabVIEW™

Page 3: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Table of Contents iii

Table of Contents Table of Contents ...................................................................................................................... iii

Introduction ................................................................................................................................v

Manual Overview ....................................................................................................................v

Supplies ...................................................................................................................................v

Supply Cost .............................................................................................................................v

Opening the LabVIEW™ Main Menu .........................................................................................3

Opening a Blank VI ....................................................................................................................7

Option 1: Opening the VI using the Main Menu ......................................................................7

Option 2: Opening the VI using the Create Project Menu .........................................................8

Adding Function to the Block Diagram ..................................................................................... 13

Adding Numeric Controls to the Front Panel ......................................................................... 13

Adding Numeric Indicators to the Front Panel ....................................................................... 15

Renaming the Numeric Controls and Indicators......................................................................... 19

Renaming the Numeric Controls ............................................................................................ 19

Renaming the Numeric Indicators .......................................................................................... 20

Adding Functions to the Block Diagram .................................................................................... 23

Adding the Add Function to the Block Diagram .................................................................... 23

Adding the Subtract Function to the Block Diagram .............................................................. 26

.............................................................................................................................................. 26

Adding the Multiply Function to the Block Diagram ............................................................. 27

Adding the Divide Function the Block Diagram .................................................................... 28

Connecting the Controls in the Block Diagram .......................................................................... 31

Connecting the X Numeric Control to the Functions .............................................................. 31

Connecting the Y Numeric Control to the Functions .............................................................. 33

Connecting the Functions to the Numeric Indicators .............................................................. 35

How Everything Connects: A Visual Overview ..................................................................... 37

................................................................................................................................................. 37

Using the Simple Calculator in the Front Panel ......................................................................... 40

Glossary .................................................................................................................................... 45

Page 4: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

iv How to Make a Simple Calculator in LabVIEW™

Index ......................................................................................................................................... 47

Page 5: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Introduction v

Introduction So you are heading into the electrical engineering program at your college and one of the

professors you talk to mentions that one of the programs you will work with is LabVIEW™

(Laboratory Virtual Instrumentation Engineering Workbench). This manual will help you to gain

some experience with this program as you make this simple calculator in LabVIEW™.

Manual Overview

After reading this manual you will know how to:

Open LabVIEW™

Open a VI (Virtual Instrument) in LabVIEW™

Locate Numeric Controls in the front panel

Locate Numeric Indicators in the front panel

Rename the Numeric Controls

Rename the Numeric Indicators

Locate the Add Function in the block diagram

Locate the Subtract Function in the block diagram

Locate the Divide Function in the block diagram

Locate the Multiply Function in the block diagram

Connect the controls, indicators, and functions together in the block diagram

Run the simple calculator using the front panel

I will not explain how to purchase or how to download LabVIEW™. I will not explain any

buttons on the front panel and block diagram that have no use for completing this project. I will

not explain how to open LabVIEW™ with Apple® computers. I will also not include the cost of

a computer or laptop because the price will vary depending on the user’s needs.

Supplies

Before you start to make this simple calculator in LabVIEW™ make sure you have the following

supplies:

LabVIEW™ software

LabVIEW™ license

Computer

After you have all the supplies, you will have everything you need to make this simple calculator

in LabVIEW™.

Supply Cost

The basic LabVIEW™ Student Edition program costs approximately $21.

Take notice of arrows surrounded by an oval to the right of buttons or other items. They

point out things that you must use or should take note of.

Words that are bolded and colored yellow can be found in the glossary on page 45.

Page 6: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

vi How to Make a Simple Calculator in LabVIEW™

Page 7: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Opening the LabVIEW™ Main Menu

Page 8: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

2 How to Make a Simple Calculator in LabVIEW™

Page 9: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Opening the LabVIEW™ Main Menu 3

Opening the LabVIEW™ Main Menu

1. Find the Start button in the bottom left-hand corner of your screen

2. Click the Start button once to open the search box

3. Type the LabVIEW™ program name without the ™ into the search box

4. Find the LabVIEW™ option in the list

Page 10: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

4 How to Make a Simple Calculator in LabVIEW™

5. Left-click the LabVIEW™ option twice, this will open the initialization screen and then

the main menu for LabVIEW™

Page 11: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

\

Opening a Blank VI

Page 12: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

6 How to Make a Simple Calculator in LabVIEW™

Page 13: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Opening a Blank VI 7

Opening a Blank VI

Option 1: Opening the VI using the Main Menu

1. Find the blank VI option on the main menu

2. Left-click the blank VI option twice, this will open a new front panel and block

diagram

Page 14: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

8 How to Make a Simple Calculator in LabVIEW™

Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project button on the main menu

2. Left-click the create project button once, this will take you to the project menu

3. Find the Blank VI option on the Create Project menu

Page 15: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Opening a Blank VI 9

4. Left-click the blank VI option once and then then left-click the Finish button at the

bottom to open a blank VI

Page 16: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

10 How to Make a Simple Calculator in LabVIEW™

Page 17: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

11

Adding Numeric Controls and Indicators to the Front Panel

Page 18: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

12 How to Make a Simple Calculator in LabVIEW™

Page 19: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Adding Numeric Controls and Indicators to the Front Panel 13

Adding Function to the Block Diagram

Adding Numeric Controls to the Front Panel

1. Right-click the front panel once, this will open the Controls palette

2. Find the Numeric Controls button in the Numeric Control sub-palette

3. Place your cursor over the Numeric Controls button to open the Numeric Controls sub-

palette

Page 20: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

14 How to Make a Simple Calculator in LabVIEW™

4. Find the Numeric Control in the Numeric Control sub-palette

5. Left-click the Numeric Control once and then place the Numeric Control where you

would like it on the front panel

6. Repeat steps 1-5 to add another Numeric Control to the front panel

7. Save your current progress

Page 21: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Adding Numeric Controls and Indicators to the Front Panel 15

Adding Numeric Indicators to the Front Panel

1. Right-click the front panel to reopen the Control palette

.

2. Find the Numeric Indicator button

3. Place your cursor over the Numeric Indicator button, this will open the Numeric

Indicators sub-palette

4. Find the Numeric Indicator in the open sub-palette

Page 22: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

16 How to Make a Simple Calculator in LabVIEW™

5. Left-click the Numeric Indicator once and then place the Numeric Indicator where you

would like it on the front panel

6. Repeat steps 1-6 to add three more Numeric Indicators to the front panel

7. Save your current progress

Page 23: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Renaming the Numeric Controls and Indicators

Page 24: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

18 How to Make a Simple Calculator in LabVIEW™

Page 25: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Renaming the Numeric Controls and Indicators 19

Renaming the Numeric Controls and Indicators

Renaming the Numeric Controls

1. Find the word numeric above the first Numeric Control

2. Double-click numeric to gain access to the text box

3. Type X into the highlighted text box

4. Repeat steps 1-2 for the second Numeric Control

5. Type Y into the second Numeric Control text box

6. Save your current progress

Page 26: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

20 How to Make a Simple Calculator in LabVIEW™

Renaming the Numeric Indicators

1. Find the word numeric above a Numeric Indicator

2. Double-click numeric to rename the Numeric Indicator

3. Type X + Y into the highlighted text box. This indicator will who the sum of X and Y

4. Repeat steps 1-2 for the second Numeric Indicator

5. Type X – Y into the text box. This indicator will show the difference of X and Y

6. Repeat steps 1-2 for the third Numeric Indicator

7. Type X * Y into the text box. This indicator will show the product of X and Y

8. Repeat steps 1-2 for the third Numeric Indicator

9. Type X/Y into the text box. This indicator will show the quotient of X and Y

10. Save your current progress

Page 27: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Adding Functions in the Block Diagram

Page 28: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

22 How to Make a Simple Calculator in LabVIEW™

Page 29: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Adding Function in the Block Diagram 23

Adding Functions to the Block Diagram

Adding the Add Function to the Block Diagram

1. Right-click the block diagram once, this will open the Functions palette

2. Find the Arithmetic and Comparisons button in the Functions palette

3. Place your cursor over the Arithmetic and Comparisons buttons, this will open the

Arithmetic and Comparison sub-palette

4. Find the Numeric button in the Arithmetic and Comparison sub-palette

Page 30: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

24 How to Make a Simple Calculator in LabVIEW™

5. Place your cursor over the Numeric button, this will open the Express Numeric sub-

palette

6. Find the Add Function in the Express Numeric sub-palette

Page 31: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Adding Function in the Block Diagram 25

7. Left-click the Add Function once and place it between the Numeric Controls and

Numeric Indicators

8. Save your current progress

Page 32: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

26 How to Make a Simple Calculator in LabVIEW™

Adding the Subtract Function to the Block Diagram

1. Repeat steps 1-5 from the Adding the Add Function part of the this chapter

2. Find the Subtract Function in the Express Numeric sub-palette

3. Left-click the Subtract Function once and place it between the Numeric Controls and

Numeric Indicators

4. Save your current progress

Page 33: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Adding Function in the Block Diagram 27

Adding the Multiply Function to the Block Diagram

1. Repeat 1-5 from the Adding the Add Function part of this chapter

2. Find the Multiply Function in the Express Numeric sub-palette

3. Left-click the Multiply Function once and place it between the Numeric Controls and

Numeric Indicators

4. Save your current progress

Page 34: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

28 How to Make a Simple Calculator in LabVIEW™

Adding the Divide Function the Block Diagram

1. Repeat 1-5 from the Adding the Add Function part of this chapter

2. Find the Divide Function in the Express Numeric sub-palette

3. Left-click the Divide Function once and place it between the Numeric Controls and

Numeric Indicators

4. Save your current progress

Page 35: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Connecting the Controls in the Block Diagram

Page 36: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

30 How to Make a Simple Calculator in LabVIEW™

Page 37: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Connecting the Controls in the Block Diagram 31

Connecting the Controls in the Block Diagram

Connecting the X Numeric Control to the Functions

1. Connect the X Numeric Control to the Add Function

2. Connect the Subtract Function to the wire between the X Numeric Control and the Add

Function

Page 38: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

32 How to Make a Simple Calculator in LabVIEW™

3. Connect the Multiply Function to the wire between the X Numeric Indicator and the

Subtract Function

4. Connect the Divide Function to the wire connected to the Multiply Function

5. Save your current progress

Page 39: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Connecting the Controls in the Block Diagram 33

Connecting the Y Numeric Control to the Functions

1. Connect the Y Numeric Control to the Divide Function

2. Connect the Multiply Function to the wire between the Y Numeric Indicator and the

Divide Function

Page 40: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

34 How to Make a Simple Calculator in LabVIEW™

3. Connect the Subtract Function to the wire connected to the Multiply Function

4. Connect the Add Function to the wire connected to the Subtract Function

5. Save your current progress

Page 41: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Connecting the Controls in the Block Diagram 35

Connecting the Functions to the Numeric Indicators

1. Connect the Add Function to the indicator X + Y

2. Connect the Subtract Function to the indicator X – Y

Page 42: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

36 How to Make a Simple Calculator in LabVIEW™

3. Connect the Multiply Function to the indicator X * Y

4. Connect the Divide Function to the indicator X / Y

5. Save your current progress

6. You have now finished making your first program in LabVIEW™

Page 43: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Connecting the Controls in the Block Diagram 37

How Everything Connects: A Visual Overview

The red line shows how the X Numeric Control connects to each function and each

indicator

The blue line shows how the Y Numeric Control connects to each function and each

indicator

Page 44: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

38 How to Make a Simple Calculator in LabVIEW™

Page 45: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Using the Simple Calculator in the Front Panel

Page 46: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

40 How to Make a Simple Calculator in LabVIEW™

Using the Simple Calculator in the Front Panel 1. Use your simple calculator by pressing the run continuously button at the top

2. The grid lines will go away when you press the run continuously button and you will get

a screen like this:

Page 47: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Using the Simple Calculator in the Front Panel 41

3. Enter numbers you would like to see added, subtracted, divided ,and multiplied into the X

and Y boxes

4. The answers to the two numbers entered will show in the indicators to the right

Page 48: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

42 How to Make a Simple Calculator in LabVIEW™

5. Press the abort execution button at the top to stop the program

Page 49: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Using the Simple Calculator in the Front Panel 43

Page 50: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

44 How to Make a Simple Calculator in LabVIEW™

Page 51: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Glossary 45

Glossary Add Function – allows the values entered to added together

Block Diagram – used to add functions for any program made

Divide Function – allows the values entered to be divided

Front Panel – used to add user functions for programs made

Multiply Function - allows the values entered to be multiplied

Numeric Control – allows values to be entered into the program by a user

Numeric Indicator – shows the outputs of the program

Subtract Function – allows the values entered to be subtracted

VI ( Virtual Instrument) – consists of the front panel and block diagram

Wire – word used to describe the line that connects functions, indicators, and controls in the

block diagram

Page 52: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

46 How to Make a Simple Calculator in LabVIEW™

Page 53: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Index 47

IndexAdd Function, 23, 24, 25, 26, 27, 28, 31,

34, 35, 45

Block Diagram, v, 7, 23, 45

Divide function, 28, 32

Front Panel, v, 7, 13, 14, 15, 16, 45

Multiply Function, 27, 32, 33, 36, 45

Numeric Control, 13, 14, 19, 31, 33, 37, 45

Numeric Indicator, 15, 16, 20, 32, 45

Subtract Function, 26, 31, 32, 34, 35, 45

VI, v, 7, 8, 9, 45

Wire, 31, 32, 33, 34

Page 54: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project
Page 55: How to Make a Simple Calculator in LabVIEW™ · 8 How to Make a Simple Calculator in LabVIEW™ Option 2: Opening the VI using the Create Project Menu 1. Find the Create Project

Lita Wilch

Style Sheet for How to Make a Simple Calculator in LabVIEW™

Page Elements Page size 11 ½ "x 8"

Margins 1"

Layout Manual

Spacing Single spacing and double spacing for text

Visual aids Screenshots

Headings Left-hanging

Type Elements Typeface Times New Roman for text

Arial for headings

Size 12 point for text

16 point for headings

14 point for subheadings

36 point for fly page headings

Style Regular text

Color Black for major headings

Blue for minor headings

Yellow for indexed words

Text Elements Capitalization All brand names

Numbers Spell out numbers 1-99

Lists Bulleted lists use black circle bullet

Numbered lists will have a period

after the number

Punctuation No period after sentences in a list

Items in a series use comma before last item

Style Handbook Technical Communications for Readers and

Writers by Brenda R. Sims