1.SIMPLE LABVIEW PROGRAMS

1.SIMPLE LABVIEW PROGRAMS
1
EX.NO.1a
DESIGN OF SIMPLE ARITHMETIC PROGRAM
AIM
To write a labVIEW program to compute the following expressions
1. (a*b)+(a/b).
2. (a*b*c)+(a%b)+log a.
SOFTWARE USED
LabVIEW software version 8.2
TOOLS USED
CONTOLS PALETTE
1. Numeric control.
2. Numeric indicator.
FUNCTIONS PALETTE
1.
2.
3.
4.
Multiplication.
Compound Arithmetic.
Quotient & Remainder.
Logarithm.
PROCEDURE
 Open the LabVIEW Environment.
 Front panel >>Controls palette >>Modern >>Numeric >>Numeric control,Numeric
indicator.
 Block diagram >>Functions palette >> Programming>> Numeric >> Multiply,
Compound Arithmetic, Quotient & Remainder.
 Block diagram >>Functions palette >> Mathematics>> Elementary & Special
functions >>Logarithm base 10.
 For (a*b)+(a/b):
2
 Wire the numeric control to the multiplication function and also to the Quotient
& Reminder function.
 Wire the output of multiplication and quotient to the addition function.
 For (a*b*c)+(a%b)+log a:
 Wire numeric controls to multiplication function.
 Wire two controls to remainder and one terminal to logarithmic function.
 Wire the outputs of all three functions to the compound addition function.
 Wire the output of addition to numeric indicators.
 Save and run the VI.
3
OUTPUT
1. (a*b)+(a/b)
FRONT PANEL
BLOCK DIAGRAM
4
2. (a*b*c)+(a%b)+log a
FRONT PANEL
BLOCK DIAGRAM
5
RESULT
Thus a program to compute two simple arithmetic expressions was executed.
6
EX.NO.1b
DESIGN OF A VI TO VERIFY SIMPLE LOGICAL CONCEPT
AIM
To design a VI to verify whether a given number is odd or even.
SOFTWARE USED
LabVIEW software version 8.2
TOOLS USED
CONTROLS PALETTE
1. Numeric contol.
2. Boolean indicator.
3. String indicator.
FUNCTIONS PALETTE
1.
2.
3.
4.
5.
Quotient and remainder.
Numeric constant.
Equal to 0?.
Select.
String constant.
PROCEDURE









Open the LabVIEW Environment.
Front panel>> Controls palette>> Modern >> Numeric >> Numeric control.
Front panel>> Controls palette>> Modern >> Boolean >>Boolean indicator.
Front panel>> Controls palette>> Modern>> String & path>> String indicator.
Block diagram >> Functions palette>> Programming>> Numeric>> Quotient
&Remainder , Numeric constant.
Block diagram >> Functions palette>> Programming>> Comparison>> Equal to 0?
Block diagram >> Functions palette>> Programming>> Comparison>>Select.
Block diagram >> Functions palette>> Programming>> String>>String constant.
Wire the numeric control to the Quotient & reminder function along with a numeric
constant-2
7
 Wire the output of the remainder function to Equal to 0? Function.
 Wire this output to Select function and also to the Boolean indicator.
 Wire the two string constants ‘Even’ to true and ‘Odd’ to false terminals of the select
function.
 Wire the output of the select function to a string indicator.
 Save and run the VI.
8
OUTPUT
FRONT PANEL
BLOCK DIAGRAM
9
RESULT
Thus a VI was designed to verify whether a given number is odd or even.
10
EX.NO.1c
DESIGN AND VERIFICATION OF SIMPLE LOGIC CIRCUITS
AIM
To design a VI to design and verify the following simple logic circuits.
1. Half adder.
2. Full adder.
SOFTWARE USED
LabVIEW software version 8.2
TOOLS USED
CONTROLS PALETTE
1. Boolean control.
2. Boolean indicator.
FUNCTIONS PALETTE
1.
2.
3.
4.
EXOR gate.
AND gate.
Compound EXOR gate.
Compound OR gate.
PROCEDURE






Open the LabVIEW Environment.
Front panel>> Controls palette >> Modern>> Boolean>> Toggle switch.
Front panel>> Controls palette >> Modern>> Boolean>> Boolean indicator.
Block diagram >>Functions palette >> Programming>> Boolean>> EXOR.
Block diagram >>Functions palette >> Programming>> Boolean>> AND.
Block diagram >>Functions palette >> Programming>> Numeric >> Compound
arithmetic >> Mode>> EXOR.
 Block diagram >>Functions palette >> Programming>> Numeric >> Compound
arithmetic >> Mode>> OR.
11
 Wire two switches to AND gate and EXOR gate for half adder.
 For full adder wire three switches to compound EXOR gate and in combination to
three AND gates. Wire the outputs of the AND gates to compound OR gate.
 Wire the resultant outputs from the logic gates to Boolean indicators to denote sum
and carry.
 Save and run the VI.
12
OUTPUT
HALF ADDER
FRONT PANEL
BLOCK DIAGRAM
13
FULL ADDER
FRONT PANEL
BLOCK DIAGRAM
RESULT
Thus a VI designed to verify Half adder and Full adder.
14
EX.NO.1d
CONVERSION OF NUMBERS
AIM
To design a VI to convert a binary number to a decimal number.
SOFTWARE USED
LabVIEW software version 8.2
TOOLS USED
CONTROLS PALETTE
1. Boolean control.
2. Numeric indicator.
FUNCTIONS PALETTE
1.
2.
3.
4.
Boolean to (0,1).
Numeric constants.
Multiplication.
Compound arithmetic.
PROCEDURE









Open the LabVIEW Environment.
Front panel>> Controls palette>> Modern>> Boolean>> Boolean Control.
Front panel>> Controls palette>> Modern>>Numeric>>Numeric indicator.
Block diagram>> Functions palette>> Programming>> Numeric>>Conversion>>
Boolean to (0, 1).
Block diagram>> Functions palette>> Programming>> Numeric>>Numeric constant.
Block diagram>> Functions palette>> Programming>> Numeric>>Multiply.
Block diagram>> Functions palette>> Programming>> Numeric>>Compound
arithmetic.
Wire the Boolean controls to multiplication functions, one each, along with numeric
constants 8, 4, 2, 1 respectively in order.
Wire the output of all the multiplication terminals to the compound arithmetic (add)
function.
15
 Save and run the VI.
OUTPUT
FRONT PANEL
BLOCK DIAGRAM
16
RESULT
Thus a VI was designed to convert binary number to decimal number.
17
EX.NO.1e
EXPERIMENT USING LOOPS
AIM
To design and verify the following programs using loops:
1. Finding the factorial of a given number using for loop with feedback node and shift
register.
2. Finding the sum of n natural numbers using while loop with feedback node and shift
register.
3. Creating an array using loops.
SOFTWARE USED
LabVIEW software version 8.2
TOOLS USED
CONTROLS PALETTE
1. Numeric control.
2. Numeric indicator.
3. Array indicator.
FUNCTIONS PALETTE
1. For loop.
2. While loop.
3. Feedback node.
4. Shift register.
5. Numeric constants.
6. Random number generator.
7. Reverse 1D array.
8. Array size.
9. Multiplication.
10. Increment.
11. Equal to 0?
12. Addition.
18
PROCEDURE
 Open the LabVIEW Environment.
 Front panel>> Controls palette>> Modern>> Numeric>> Numeric control, Numeric
indicator.
 Front panel>> Controls palette>> Modern>> Array, Matrix & Cluster>> Array
Control.
 Block diagram>>Functions palette>> Programming>> Structures>> For loop, While
loop, feedback node.
 Block diagram>>Functions palette>> Programming>> Numeric>>Numeric constants,
Random number generator, Increment, Multiply, Add.
 Block diagram>>Functions palette>> Programming>> Comparison>> Equal to?
 Block diagram>>Functions palette>> Programming>> Array>> Reverse 1D array,
Array Size.
 Block diagram>>For loop>> Add shift register.
 Factorial using for loop:
 Wire the numeric control to the N terminal of for loop.
 Initialize the shift register or feedback node to 1.
 Wire the iteration terminal to increment function and connect it to
multiplication along with shift register/feedback node.
 Wire the output to a numeric indicator.
 Sum of n natural numbers using while loop :
 Initialize the shift register or feedback node to 0.
 Wire the iteration terminal to addition along with shift register/feedback node.
 Wire the iteration terminal and numeric control to equal to? Function.
 Wire the equal to? Function to condition terminal.
 Wire the output to a numeric indicator.
 Creating an array using for loop:
 Wire a numeric constant to the N terminal of for loop.
 Place a random number generator within the loop and connect it to an array
indicator placed outside the loop.
 Wire the array output to array size and reverse 1D array functions.
 Obtain the respective outputs.
 Save and run the VI.
19
OUTPUT
FACTORIAL USING FOR LOOP
1. FEEDBACK NODE
FRONT PANEL
BLOCK DIAGRAM
20
SHIFT REGISTER
FRONT PANEL
BLOCK DIAGRAM
21
SUM OF N NATURAL NUMBERS USING WHILE LOOP
1.
FEEDBACK NODE
FRONT PANEL
BLOCK DIAGRAM
22
2.
SHIFT REGISTER
FRONT PANEL
BLOCK DIAGRAM
23
CREATING ARRAY USING FOR LOOP
FRONT PANEL
BLOCK DIAGRAM
24
RESULT
Thus a VI was designed to perform experiments using loops.
25
2.SIMULATION OF SINE SIGNAL AND
DISPLAYING IN TIME AND
FREQUENCY DOMAIN
26
EX.NO.2a
GENERATION OF SINE WAVEFORM
AIM
To write a lab VIEW program to generate sine waveform using simulate signal and
sine waveform generator.
SOFTWARE USED
LabVIEW software version 8.2
TOOLS USED
CONTROLS PALETTE
1. Waveform Graph.
FUNCTIONS PALETTE
1.SineWaveform.Vi.
2.Numeric Constants.
3.Simulate signal.
PROCEDURE
Using sine Waveform
 Open the LabVIEW Environment.
 Front panel >>Controls palette >>Modern >>Graph>>Waveform Graph.
 Block diagram >>Functions palette >> Programming >> Waveform >> Analog
Waveform >>Waveform Generation>>Sine waveform.vi.
 Wire the Numeric Constants to Frequency, Amplitude, Phase and Samples to the Sine
Waveform.
 Wire the Output of Sine Waveform to the Waveform Graph.
 Save and run the VI.
27
Using Simulate Signal Function
 Start the LabVIEW Environment.
 Front panel >>Controls palette >>Modern >>Graph>>Waveform Graph.
 Block diagram >>Functions palette >> Programming >> Waveform >> Analog
Waveform >>Generation>>Simulate Signal
 By Double Clicking Over Simulate Signal Change the Frequency , amplitude ,phase
and samples of sine waveform.
 Wire the Output of Sine Waveform to the Waveform Graph.
 Save and run the VI.
28
OUTPUT
Using sine waveform
FRONTPANEL
BLOCKDIAGRAM
29
Using Simulate Signal Function
FRONTPANEL
BLOCKDIAGRAM
RESULT
Thus a program to Generate sine waveform was executed using sine waveform and
simulate signal function.
30
EX.NO.2b
FREQUENCY DOMAIN REPRESENTATION OF SINE
SIGNAL
AIM
To write lab VIEW program to obtain frequency domain representation of sine signal.
SOFTWARE USED
LabVIEW software version 8.2
TOOLS USED
CONTROLS PALETTE
1.Wave form Graph.
FUNCTIONS PALETTE
1. Simulate Signal.
2. FFT.
3. FFT Size.
4.Dynamic to Array Converter.
PROCEDURE
 Open the LabVIEW Environment.
 Front panel >>Controls palette >>Modern >>Graph>>Waveform Graph.
 Block diagram >>Functions palette >> Programming >> Waveform >> Analog
Waveform >>Generation>>Simulate Signal
 Block diagram >>Functions palette >>Signal manipulation>>Convert from Dynamic
Data.
 By Double Clicking over Simulate Signal Change the Frequency, amplitude, phase
and samples of sine waveform.
 Wire the Output of Sine Waveform to the Waveform Graph.
 And the output is also wired to FFT through Convert from Dynamic data and the other
input is FFT size numeric control.
 The output of FFT is wired to Waveform Graph.
 Save and run the VI.
31
30
OUTPUT
FRONTPANEL
32
31
BLOCKDIAGRAM
33
RESULT
Thus the program to obtain frequency domain representation of sine signal was
executed.
34
35