Você está na página 1de 9

ECE 100 Fundamentals of LabVIEW Programming

BASIC ARITHMETIC, COMPARISON AND BOOLEAN CONTROL OPERATIONS IN LABVIEW


Activity No. 2
I. INTENDED LEARNING OUTCOMES
At the end of this activity, the student shall be able to:
1. Distinguish between an Arithmetic and Comparison function.
2. Enumerate the operations under Arithmetic, Comparison and Boolean functions.
3. Create a useful VI that performs arithmetic and comparison operations in LabVIEW.
II. BACKGROUND INFORMATION
One of the fundamental LabVIEW applications is in mathematical and engineering calculations.
This platform allows the user to create a simple program using basic arithmetic functions and use the result
of these programs to evaluate a certain scenario using Boolean and comparison functions.
The basic arithmetic functions in LabVIEW include but not limited to addition, subtraction,
multiplication, division, square root, reciprocal and many more. Of course, these functions are the building
blocks of program requiring elementary and advanced calculations. Comparison operations however
include, but is not also limited to equal, less than, greater than, greater than or equal, less than or equal,
equal to, not equal to etc.
The use of arithmetic and comparison functions can be interconnected with how the results of
arithmetic functions may be evaluated. Comparison functions may be used to compare numerical values to
other numerical values such that the result of this comparison allows the program to interpret certain
program specifications. This interpretation may then be visually presented by a Boolean function such as
LEDS. Boolean LEDs may be used to visually notify the user on the numeric output and this notification
interprets something decisive or a quantity in range. However, there are Boolean functions that may be
used as input. This includes, but not limited to toggle switch, slide witch, OK, Cancel and STOP button.
They may refer to multiple states such as ON/OFF or TRUE or FALSE.

Basic Arithmetic Functions

Basic Comparison Functions

Page 12

ECE 100 Fundamentals of LabVIEW Programming


III. LEARNING ACTIVITIES
ACTIVITY 2.1: BASIC ARITHMETIC OPERATIONS IN LABVIEW
1. Open LabVIEW 2012. Once the Welcome screen windows appear, click on Blank VI. The Front Panel
and Block Diagram window should appear simultaneously as shown below:

2. Create a VI on Front Panel as shown. The first three input numbers will be Numeric Controls, the next
three will be Knobs and the last four inputs will be Horizontal Pointer Slide. You can access all the
controls by Right-clicking anywhere in the Front PanelControlsNumeric and then select Numeric
Control, Knob and Horizontal Pointer slide. The front panel should look like as shown in the figure
below:

Page 13

ECE 100 Fundamentals of LabVIEW Programming


3. Change the scale (range) of Input 4 and Input 5 Knobs. Select -100 and 100 as the minimum and
maximum range respectively. Connect the elements in the Block Diagram as shown below:

Note: To create constant on one of the inputs of the Division operation, right click on the node, choose
Create and then select Constant.
4. Click on the Run Continuously button on the Front Panel. Select desired inputs by adjusting the
controls on your desired level and confirm your calculations using manual computation. Save your VI as
Act2_1_1.VI
Question: Explain how the VI works? What is the function of the given program above?

Question: What do you notice if you use the numeric controls Inputs 1 to 3 compared with the rest
of the Input Controls?

Page 14

ECE 100 Fundamentals of LabVIEW Programming


5. Modify the Block Diagram of the previous VI done as shown below and click on Run Continuously
button to execute the program. Then save your VI as Act2_1_2.VI

Question: How does the modified VI work now? How do you compare the two VIs?

Question: What function under Arithmetic functions has been used to get rid of multiple Add icons?
How do you find this function? (State the sequence to access this function). How does it work?

Page 15

ECE 100 Fundamentals of LabVIEW Programming


ACTIVITY 2.2: BOOLEAN CONTROL AND COMPARISON OPERATIONS IN LABVIEW
1. Open the VI Act2_1_2.VI and modify it as shown in the figure below by adding two round LEDs. To add
LEDs, Right-click anywhere in the Front PanelControlsBooleanRound LED. Rename the LED
as PASSED and FAILED. Change all controls to Numeric control.
**Note: The default color of the LED shown is dark green (OFF). Once the LED lit, it will turn to light green
(ON). Change the OFF color of both LEDs to Black. This can be done by Right-clicking on
LEDPropertiesColorsOffChoose Black. Change also the ON color of the LED labelled as
FAILED to Red.
The Front Panel must resemble the figure below:

Question: How can you change Knobs and Slide Pointers to a Numeric Control without deleting the
previously used controls?

Question: How and when can we use LEDs?

Page 16

ECE 100 Fundamentals of LabVIEW Programming


2. Once the Front Panel has been modified, do the same with its corresponding Block Diagram. Do the
revision of the Block Diagram as shown below:

3. Save the VI as Act2_2_1.VI.


Numeric control respectively:
Input 1 = 74
Input 2 = 77
Input 3 = 68

Before running, manipulate the controls and input the following values to
Input 4 = 45
Input 5 = 69
Input 6 = 70

Input 7 = 67
Input 8 = 77
Input 9 = 70

Input 10 = 71

Next, Run the VI by clicking on the Run Continuously button.


Question: What happened after you run the VI with the input values indicated above were set?

4. Change the values of input controls as shown below: Observe the LEDs.
Input 1 = 783
Input 4 = 100
Input 7 = 83
Input 2 = 77
Input 5 = 69
Input 8 = 77
Input 3 = 95
Input 6 = 95
Input 9 = 100

Input 10 = 92

Page 17

ECE 100 Fundamentals of LabVIEW Programming


Question: How does the entire VI work?

IV. MACHINE PROBLEM


1. Implement a LabVIEW Program that computes the average grade of 10 courses in Electronics
Engineering program. Modify your VI previously done. The front panel should closely resemble the FP
below: Save your VI as MacPro2_1.VI

The VI should also do the following:


The PASSED LED will light using light green color when the average grade is 75 or higher.
The FAILED LED will light using red color when the average grade is lower than 75.
The average grade should be categorized according to the point grade range. Meaning the LED
corresponding to a point grade should light when the average grade falls in this range.
Customize your VI and make your program more visually presentable.
Do not use advanced objects. Use only basic arithmetic, comparison and Boolean operations.
Page 18

ECE 100 Fundamentals of LabVIEW Programming


2. Modify Machine Problem no. 1 such that youre VI will also compute for the variance and standard
deviation of the grades in the 10 courses. The formula for the variance and standard deviation is shown
below: Save your VI as MacPro2_2.VI

Where x is the grade per course is the average grade and N is the number of data.
Do not use advanced objects. Use only basic arithmetic operations to compute variance and
standard deviation
3. Create a LabVIEW program that computes the final grade of the student in a particular course. Employ
the TIP Grading system. The following are the components of the grades:

Class Standing:
Quizzes 70%
Seatworks 20%
Assignments -10%
Prelim, Midterm and Final Exams
Prelim, Midterm and Final grades.

Your VI should meet the following:


Allow the user to encode class standing per term, set 5 quizzes, 5 seatworks and 5 assignments
per term
The program shows the prelim, midterm and final grade.
Use two Boolean LEDs to indicate if the final grade is passed or failed.
Make your VI visually presentable.
Do not use advanced objects. Use only basic arithmetic operations to solve the roots.
V. ASSESSMENT TASKS
1. When you right-click on an empty space in a block diagram window, and choose
ProgrammingNumeric, what are the objects do you see as you browse on the given sequence? State
the functions of the objects you see.

Page 19

ECE 100 Fundamentals of LabVIEW Programming


2. When you right-click on an empty space in a block diagram window, and choose
ProgrammingComparison, what are the objects do you see as you browse on the given sequence?
State the functions of the objects you see.

3. What is the function of a Boolean operator? Why do we consider LEDs as Boolean components?

4. What are the other Boolean objects? State their functions.

5. How does arithmetic, comparison and Boolean objects may be interconnected with each other? Give
some example of programs (not those which are in this activity) that best exemplify the use of the said
three functions?

VI. CONCLUSION
VII. RUBRICS FOR LABORATORY PERFORMANCE

Page 20

Você também pode gostar