Programming activities, Exercises of Programming Languages

BAsic functions in programming to learn

Typology: Exercises

2019/2020

Uploaded on 09/13/2021

eniger
eniger 🇵🇭

5 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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.
Page 12
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Programming activities and more Exercises Programming Languages in PDF only on Docsity!

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.

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 NumericControl , Knob and Horizontal Pointer slide. The front panel should look like as shown in the figure below:
  1. 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?

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?

Question: How does the entire VI work? 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.
  1. 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.
  2. What is the function of a Boolean operator? Why do we consider LEDs as Boolean components?
  1. How does arithmetic, comparison and Boolean objects may be interconnected with each other? Give some examples of programs (not those which are in this activity) that best exemplify the use of the said three functions? VI. CONCLUSION The three control operations, specifically the arithmetic, comparison, and boolean functions, are indeed the most common yet usually used operations in making a programme in LabVIEW. Through this software, different devices are made by different students or professionals. Using the VIs as an avenue to create a program with different functionality in different possible ways. Moreover, the programming platform, front panel ,may be customized to our desire through the block diagram. Whatever is comfortable for our use. VII. RUBRICS FOR LABORATORY PERFORMANCE (Simulation Activity)