0% found this document useful (0 votes)
148 views

Labview Programming

The document contains the answers to 10 LabVIEW programming assignment questions. For each question, it lists the LabVIEW functions that would be used to solve the problem, including functions for calculations, logic operations, string processing, and displaying messages.

Uploaded by

James Wood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views

Labview Programming

The document contains the answers to 10 LabVIEW programming assignment questions. For each question, it lists the LabVIEW functions that would be used to solve the problem, including functions for calculations, logic operations, string processing, and displaying messages.

Uploaded by

James Wood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

LABVIEW PROGRAMMING

ASSIGNMENT – 01

Question 01. The length and breadth of a rectangle and the radius of a circle are inputs. Build
a VI to calculate the area and perimeter of the rectangle, and the area and circumference of
the circle.

Answer: Functions Used:-


(i) Square Function: Computes the square of the input value.

(ii) Multiply Function: Returns the product of the inputs. If you wire two
waveform values or two dynamic data type values to this function, error
in and error out terminals appear on the function.

(iii) Add Function: Computes the sum of the inputs.

(iv) Formula Node: Evaluates mathematical formulas and expressions similar to


C on the block diagram. The following built-in functions are allowed in
formulas: abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceil, cos, cosh,
cot, csc, exp, expm1, floor, getexp, getman, int, intrz, ln, lnp1, log, log2,
max, min, mod, pow, rand, rem, sec, sign, sin, sinc, sinh, sizeOfDim, sqrt,
tan, tanh. There are some differences between the parser in
the Mathematics VIs and the Formula Node.
Question 02. Divide two numbers and glow an LED if the result of the division is theinfinity
(i.e., the divisor is zero).

Answer: Functions Used:-


(i) Quotient & Remainder Function: Computes the integer quotient and the
remainder of the inputs. This function rounds floor(x/y) to the nearest
integer towards -inf.

(ii) Equal ? Function: Returns TRUE if x is equal to y. Otherwise, this function


returns FALSE. You can change the comparison mode of this function.
Question 03.Create NOT,AND and OR gates using NAND gate and verify truth table.

Answer: Functions Used:-


(i) NOT AND Function: Computes the logical NAND of the inputs. Both inputs
must be Boolean values, numeric values, or error clusters. If both inputs are
TRUE, the function returns FALSE. Otherwise, it returns TRUE. This
function performs bitwise operations on numeric inputs.
Question 04. Perform OR and AND operations pf an array of Boolean inputs.

Answer: Functions Used:-


(i) OR Function: Computes the logical OR of the inputs. Both inputs must be
Boolean values, numeric values, or error clusters. If both inputs are FALSE,
the function returns FALSE. Otherwise, it returns TRUE.

(ii) AND Function: Computes the logical AND of the inputs. Both inputs must be
Boolean values, numeric values, or error clusters. If both inputs are TRUE,
the function returns TRUE. Otherwise, it returns FALSE.

(iii) Merge Signal Function: Merges two or more supported signals, such as scalar
numerics, 1D or 2D arrays of numerics, scalar Booleans, 1D or 2D arrays of
Booleans, waveforms, or 1D arrays of waveforms, into a single
output. Resize the function to add inputs. This function automatically appears
on the block diagram when you wire a signal output to the wire branch of
another signal.

(iv) Transpose 2D Array Function: Rearranges the elements of 2D array such


that 2D array[i,j] becomes transposed array[j,i].

(v) Boolean Array to Digital VI Function: Converts a 2D Boolean array to a


digital waveform or digital data. You must manually select the polymorphic
instance you want to use.
Question 05. Perform AND,OR and XOR operations using more than two Boolean inputs
(individual inputs, not an array of inputs).

Answer: Functions Used:-


(i) OR Function: Computes the logical OR of the inputs. Both inputs must be
Boolean values, numeric values, or error clusters. If both inputs are FALSE,
the function returns FALSE. Otherwise, it returns TRUE.

(ii) AND Function: Computes the logical AND of the inputs. Both inputs must be
Boolean values, numeric values, or error clusters. If both inputs are TRUE,
the function returns TRUE. Otherwise, it returns FALSE.

(iii) NOT EXCLUSIVE OR Function: Computes the logical negation of the


logical exclusive or (XOR) of the inputs. Both inputs must be Boolean values,
numeric values, or error clusters. If both inputs are TRUE or both inputs are
FALSE, the function returns TRUE. Otherwise, it returns FALSE.
Question 06. The salary of X is input. His dearness allowance is 40% of basic salary and
house rent allowance is 20% of basic salary. Build a VI to Calculate his gross salary.

Answer: Functions Used:-


(i) Formula Node: Evaluates mathematical formulas and expressions similar to C on
the block diagram. The following built-in functions are allowed in
formulas: abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, cot, csc,
exp, expm1, floor, getexp, getman, int, intrz, ln, lnp1, log, log2, max, min, mod,
pow, rand, rem, sec, sign, sin, sinc, sinh, sizeOfDim, sqrt, tan, tanh. There are
some differences between the parser in the Mathematics VIs and the Formula
Node.
Question 07. Check whether the given string input is empty, a space, printable ACSII
character, hexadecimal, digit and octal number.

Answer: Functions Used:-


(i) Empty String? Path Function: Returns TRUE if string/path is an empty
string or an empty path. Otherwise, this function returns FALSE. This function
is also designed to work with variants, pictures, and DSC tags.

(ii) White Space? Function: Returns TRUE if char represents a white space
character, such as Space, Tab, Newline, Carriage Return, Form Feed, or
Vertical Tab. If char is a string, this function uses the first character in the
string. If char is a number, this function interprets it as the ASCII value of a
character. If char is a floating-point number, this function rounds to the
nearest integer. Otherwise, the function returns FALSE.

(iii) Printable? Function: Returns TRUE if char represents a printable ASCII


character. If char is a string, this function uses the first character in the string.
If char is a number, this function interprets it as the ASCII value of a
character. If char is a floating-point number, this function rounds to the
nearest integer. Otherwise, this function returns FALSE.

(iv) Hex Digit? Function: Returns TRUE if char represents a hex digit ranging
from 0 through 9, A through F, or a through f. If char is a string, this function
uses the first character in the string. If char is a number, this function
interprets it as the ASCII value of a character. If char is a floating-point
number, this function rounds to the nearest integer. Otherwise, this function
returns FALSE.

(v) Decimal Digit? Function: Returns TRUE if char represents a decimal digit
ranging from 0 through 9. If char is a string, this function uses the first
character in the string. If char is a number, this function interprets it as the
ASCII value of a character. If char is a floating-point number, this function
rounds to the nearest integer. Otherwise, this function returns FALSE.

(vi) Octal Digit? Function: Returns TRUE if char represents an octal digit ranging
from 0 through 7. If char is a string, this function uses the first character in the
string. If char is a number, this function interprets it as the ASCII value of a
character. If char is a floating-point number, this function rounds to the
nearest integer. Otherwise, this function returns FALSE.
Question 08. Form a complex number using two inputs x and y. For that complex number,
find the complex conjugate and polar components.

Answer: Functions Used:-


(i) Re/Im to Complex Function: Creates a complex number from two values in
rectangular notation.

(ii) Complex Conjugate Function: Produces the complex conjugate of x + iy.

(iii) Complex To Polar Function: Breaks a complex number into its polar
components.
Question 09. Check whether the given number is in limit (specify upper and lower limits).

Answer: Functions Used:-


(i) In Range and Coerce Function: Determines whether x falls within a range
specified by the upper limit and lower limit inputs and optionally coerces the
value to fall within the range. The function performs the coercion only
in Compare Elements mode. This function accepts time stamp values if all
inputs are time stamp values. You can change the comparison mode of this
function.

(ii) Equal? Function: Returns TRUE if x is equal to y. Otherwise, this function


returns FALSE. You can change the comparison mode of this function.

(iii) Select Function: Returns the value wired to the t input or f input, depending on
the value of s. If s is TRUE, this function returns the value wired to t. If s is
FALSE, this function returns the value wired to f.

(iv) Display Message to User Express VI: Displays a standard dialog box that
contains an alert or a message for users.
Question 10. The population of a town is 80,000 and the percentage of men is 52. The
percentage of total literacy is 48. If the total percentage of literate men is 35 of the total
population, build a VI to find the total number of illiterate men and women.

Answer: Functions Used:-


(i) Formula Node: Evaluates mathematical formulas and expressions similar to C on
the block diagram. The following built-in functions are allowed in
formulas: abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, cot, csc,
exp, expm1, floor, getexp, getman, int, intrz, ln, lnp1, log, log2, max, min, mod,
pow, rand, rem, sec, sign, sin, sinc, sinh, sizeOfDim, sqrt, tan, tanh. There are
some differences between the parser in the Mathematics VIs and the Formula
Node.
Question 11. Find the hexadecimal value of the given input string and the display the
hexadecimal values in an array.

Answer: Functions Used:-


(i) String to Byte Array Function: Converts a string into an array of unsigned bytes.
Each byte in the array has the ASCII value of the corresponding character in the
string.

(ii) Number to Hexadecimal String Function: Converts number to a string of


hexadecimal digits at least width characters wide or wider if necessary. The
digits A–F always appear in uppercase in the output string. If number is floating-
point or fixed-point, it is rounded to a 64-bit integer before conversion.
Question 12. Find the equivalent gray code for a given BCD.

Answer: Functions Used:-


(i) OR Function: Computes the logical OR of the inputs. Both inputs must be
Boolean values, numeric values, or error clusters. If both inputs are FALSE,
the function returns FALSE. Otherwise, it returns TRUE.

(ii) NOT EXCLUSIVE OR Function: Computes the logical negation of the


logical exclusive or (XOR) of the inputs. Both inputs must be Boolean values,
numeric values, or error clusters. If both inputs are TRUE or both inputs are
FALSE, the function returns TRUE. Otherwise, it returns FALSE.
Question 13. Find the equivalent BCD of an input binary value.

Answer: Functions Used:-


(i) NOT : Computes the logical negation of the input. If x is FALSE, the function
returns TRUE. If x is TRUE, the function returns FALSE.This function
performs bitwise operations on numeric inputs.

(ii) OR Function: Computes the logical OR of the inputs. Both inputs must be
Boolean values, numeric values, or error clusters. If both inputs are FALSE,
the function returns FALSE. Otherwise, it returns TRUE.

(iii) AND Function: Computes the logical AND of the inputs. Both inputs must be
Boolean values, numeric values, or error clusters. If both inputs are TRUE, the
function returns TRUE. Otherwise, it returns FALSE.
Question 14. Design a decoder for two binary inputs.

Answer: Functions Used:-


(i) NOT Function : Computes the logical negation of the input. If x is FALSE, the
function returns TRUE. If x is TRUE, the function returns FALSE.This
function performs bitwise operations on numeric inputs.

(ii) AND Function: Computes the logical AND of the inputs. Both inputs must be
Boolean values, numeric values, or error clusters. If both inputs are TRUE, the
function returns TRUE. Otherwise, it returns FALSE.
Question 15. Find logarithmic values for inputs x and y(log(x)and log(y)). Add the log
Values and find 10^(log(x)+log(y)).Verify that the result is equal to the product of x and y.

Answer: Functions Used:-

(i) Logarithmic Base 10 Function: Computes the base 10 logarithm of x. If x is


0, log(x) is negative infinity. If x is not complex and is less than 0, log(x) is NaN.
The connector pane displays the default data types for this polymorphic function.

(ii) Power of 10 Function: Computes 10 raised to the x power.

(iii) Multiply Function: Returns the product of the inputs. If you wire two waveform
values or two dynamic data type values to this function, error in and error
out terminals appear on the function.

(iv) Add Function: Computes the sum of the inputs.


Question 16. Design a 4 x 1 multiplexer with enable and select options.

Answer: Functions Used:-


(i) NOT Function : Computes the logical negation of the input. If x is FALSE, the
function returns TRUE. If x is TRUE, the function returns FALSE.This
function performs bitwise operations on numeric inputs.

(ii) Compound Arithmetic Function: Performs arithmetic on one or more numeric,


array, cluster, or Boolean inputs. To select the operation (Add, Multiply,
AND, OR, or XOR), right-click the function and select Change Mode from
the shortcut menu. When you select this function from the Numeric palette,
the default mode is Add. When you select this function from
the Boolean palette, the default mode is OR.
Question 17. Compute the equations (x1+2)*3and 5+x2*log(x2) using functions,Expression
node and express formula for the given x1 and x2.

Answer: Functions Used:-


(i) Expression Node Function : Use the Expression Node to calculate
expressions that contain a single variable. The following built-in functions
are allowed in
formulas: abs, acos, acosh, asin, asinh, atan, atanh, ceil, cos, cosh, cot, csc,
exp, expm1, floor, getexp, getman, int, intrz, ln, lnp1, log, log2, max, min,
mod, rand, rem, sec, sign, sin, sinc, sinh, sizeOfDim, sqrt, tan, tanh.
Question 18. For the two Boolean inputs use implies Function and verify the results.

Answer: Functions Used:-


(i) Implies Function: Negates x and then computes the logical OR of y and the
negated x. Both inputs must be Boolean values, numeric values, or error
clusters. If x is TRUE and y is FALSE, the function returns FALSE. Otherwise,
it returns TRUE.
Question 19. From the given two numeric inputs, find the maximum value and minimum
value.

Answer: Functions Used:-


(i) Max & Min Function: Compares x and y and returns the larger value at the top
output terminal and the smaller value at the bottom output terminal. This
function accepts time stamp values if all inputs are time stamp values. If the
inputs are time stamp values, the function returns the later time at the top and
the earlier time at the bottom. You can change the comparison mode of this
function.
Question 20. Change the dimension of a LED using property node and also the position of the
LED.

Answer: Functions Used:-

(i) Property Node Function: Gets (reads) and/or sets (writes) properties of
a reference. Use the property node to get or set properties and methods on local or
remote application instances, VIs, and objects. You also can use the Property
Node to access the private data of a LabVIEW class. The Property Node
automatically adapts to the class of the object that you reference. LabVIEW
includes Property Nodes preconfigured to access XML Properties, VISA
properties, .NET properties, and ActiveX properties.

You might also like