M&I Lab Manual
M&I Lab Manual
Observation/Record
VIT
FALL 2013-2014
Name : ----------------------------------------
Branch : ----------------------------------------
Year : ----------------------------------------
Lab. In-Charge:
Reg. No.______________
Certified that this is the bonafide record of the practical work done by Mr. /Ms
Faculty In-charge
i
Degree: B. Tech. Discipline: E.E.E
Course name: Measurement and Instrumentation Lab Course Code: EEE229L/231L
List of Experiments
Cycle-I
Cycle – II
S. Vivekanandan
Lab. In-charge
ii
INDEX
S. No Date Experiment Page Marks Signature
No.
iii
School of Electrical Engineering
Measurement and Instrumentation Lab
Rules and Regulations
Safety Regulations
Safety is the most important consideration for students, staff, & faculty within the undergraduate
labs. Safety rules MUST be followed at ALL times. Failure to follow Safety rules may result in
expulsion from the labs (which could adversely affect your grade!).
The most important consideration in doing experiments or using equipment in the labs:
THERE IS NO SUCH THING AS A “SAFE” VOLTAGE OR CURRENT!
1. No student will under ANY circumstances alter ANY wiring leading into or coming from a
standard 220 VAC wall outlet, including outlets that are built into the workstations.
2. Safety covers will NEVER be removed from any equipment, including all lab instruments and
computers.
3. Any repair or system check (including something as simple as fuse replacement) on bench
equipment will only be done by lab assistants.
4. The lab is a professional environment. Appropriate clothing will be worn at all times
whenever working inside the lab itself. Appropriate is defined as clothing that will not provide a
distraction to other students and provide sufficient and proper protection to an individual present
in a minimal hazard industrial environment.
5. Students in any lab course may not begin work in the lab at any time without the concerned
faculty or the lab assistants being present. Present is defined as ―in the same room (or adjacent
room) at the same time.‖ No student or student group may work in the lab alone at any time (that
is, without designated supervision).
6. Students must ensure that any circuits being worked on are either deenergized (including the
grounding of any possible components that may hold a charge) or are part of standard authorized
lab experiments that have been designed to be energized while testing and measurement is taking
place.
7. Undergraduate students will not work on any personal projects without first clearing the work
with any faculty/Lab in-charge.
8. Students are expected to act in a professional manner at all times while in the lab. Practical
jokes and horseplay are unacceptable in the lab environment.
iv
9. Soldering irons are HOT! Care must be taken to protect yourself and others from being
burned. Do NOT assume that a soldering iron is cool simply because it has been turned off! It is
quite possible that the soldering station was in use just before your arrival in the lab.
10. When working at soldering stations, students will NOT ―flick‖ molten solder off the solder
tip. Use the wetted sponge that is provided with the soldering iron holder or the steel wool cup
solder remover.
11. Students MUST turn off soldering irons when they are finished. Leaving soldering irons
energized is both a safety hazard AND an equipment hazard.
Lab Regulations
The following regulations are mandatory for every lab course held in the labs. These regulations
are in place to provide protection for both students and the lab equipment. Failure to follow these
regulations may result in expulsion from the labs and a failing grade.
1. Test equipment may NOT be moved from one work station position to another.
2. Computer and test equipment covers WILL NOT be removed by anyone other than lab
assistant.
3. Food and Drink are NOT allowed in the lab at ANY time.
4. Students are expected to show up for their lab class at the scheduled time. Faculties have been
instructed that they can deduct up to 50% of the lab grade for late arrival, depending on the
extent of the tardiness.
5. In general, electronic components are considered to be consumable parts, which are subject to
natural attrition. If you break or otherwise damage a component, notify your Lab Assistants.
7. Since there are many courses in our labs each day, each workstation will collect a certain
amount of clutter from each use. Students are required to clean up their immediate workstation
after completion of their experiment prior to leaving the lab for the day. Leave the workstation
position in as good shape as you found it for the next students that will use it. This includes
cleaning bench tops, straightening instruments, and returning cables to the concerned Lab
Assistant.
8. Leaving your workstation repeatedly during your scheduled lab time is disruptive to your
classmates and the Lab assistant. Please keep this to a minimum in order to maximize not only
YOUR lab experience but also that of your team member(s).
9. Your Lab. assistant MUST inspect your workstation prior to your leaving the lab.
Do not leave until the Lab. Assistant has inspected your workstation and approved its
condition.
v
10. If leaving a soldering station for any time longer than a minute or two, turn the soldering
station OFF. Leaving the station on when unused causes extra wear on the equipment, and also
poses an injury hazard.
The following section covers overall lab security. It also covers various aspects of equipment
checkout. Please note that violation of these policies may result in severe disciplinary action.
1. Lab assistants will ensure that NO laboratory room is unattended. Our labs contain a large
amount of valuable equipment, and this investment must be promoted by paying strict attention
to security requirements.
2. Removing ANY equipment from a lab without prior approval and checkout procedures
constitutes theft and will be punished as such. Students, Lab assistant and instructors are NOT
authorized to remove ANY equipment from ANY lab without prior permission form authorities.
3. For all lab courses held in the lab, students must have either their faculty or Lab Assistant
present in the lab when they are working.
2. NEVER surf the net on your lab computer. Lab computers are specifically meant to control
experiments and collect temporary experimental data.
Students may have access to the open lab during the normal weekday hours, when supervision is
available by lab personnel. In general, students are not authorized to work alone in the open lab.
Note that open lab hours are NOT a guarantee of lab access. They are a good faith effort to
enable student access to equipment as much as possible during normal business hours.
Occasional closings of the open labs may be necessary due to lab personnel responsibilities.
vi
Laboratory Course Evaluation Procedure:
The Lab Course will be evaluated for 100 marks on the following basis:
i. Continuous assessment : 50
( I ) Continuous assessment:
vii
I have read and understood the Safety regulations, Lab rules, policies and the Evaluation
Procedure.
Name : ____________________________________
Signature : ____________________________________
Date : ____________________________________
viii
SCHOOL OF ELECTRICAL ENGINEERING
Cycle-I
APPRATUS REQUIRED:
SNO ITEM SPECIFICATION QUANTITY
1 Kelvin double bridge kit ------- 1
2 Patch cards -------
3 Multimeter ------- 1
4 Unknown resistor --------
THEORY:
The Kelvin double bridge incorporate the idea of a second set of ratio arms hence
the name double bridge. The first set of ratio arms are P & Q. The second set of
ratio arms P & Q is used to connect the galvanometer at an appropriate point to
eliminate the effect of connecting lead resistance ‗r‘ between the known resistance
R and the standard resistance S . The ratio P/Q is made equal to p/q. Under balance
condition there is no current through the galvanometer, which means drop is equal.
Solving we get
pr
R
ECA ECB P p q r
E AD E BD Q qr
S
p q r
P R( p q r ) pr
Q S ( p q r ) qr
divide by Q( p q r)
1
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
2
P Pqr pr
S R
Q Q( p q r ) p q r
P qr P p
R S
Q p q r Q q
p P
„r‟ will not have any effect on measurement of resistance if is chosen to be equal to
q Q
If indicates that the resistance of connecting lead r, has no effect on the measurement provided
that the two sets of ratio arms have equal ratios. Using this kit we can measure resistance
between range 0.1ohm to 0.8ohm..There is a range selection on the arm Q, q have been changed
p P
so that option of balancing the bridge to exact ratio of is available. So here R is
q Q
P
calculated as R S.
Q
PROCEDURE:
1. Connections are made as per connections diagram.
2. Connect the unknown resistance at Rx terminal and switch ON the unit.
3. Select the range selection switch at the point where the meter reads least possible value of
voltage.
4. Vary the potentiometer (P1) to obtain null balance.
5. Switch OFF the unit and find the resistance using multimeter at P1.
6. Tabulate the reading accordingly and find the unknown resistance.
3
TABULAR COLUMN:
MODEL GRAPH:
4
MODELCALCULATION:
RESULT:
TYPICAL QUESTIONS:
1. Kelvin double bridge is used for measuring low resistances from approximately
to
3. Under what condition the connecting lead resistance will not have any effect on the measurement
of resistance.
5
Graph
Displacement Vs (SC2-SC1)
Liner
range
1800phase
shift
Displacement
6
Exp. No. 2 Displacement measurement using LVDT
Objective:
To measure displacement using LVDT and to show its characteristics
Apparatus:
1. LVDT
2. Signal Conditioning Unit
3. Digital Multimeters
Procedure:
1. The LVDT is connected to supply and signal conditioning unit.
2. Zero position is adjusted by keeping the core in the middle of the LVDT
3. Move the core in one direction using screw gauge and take 10 readings of SC1 and SC2. Now
rotate the screw in opposite direction and note another 10 readings and come back to the zero
position. Now move it other direction and take the reading as explained above
4. The o/p voltage is calculated using the formula SC2-SC1 voltage
5. A graph of displacement Vs O/P voltage should be plotted.
7
Observation:
Sl. Displacement Output of LVDT
NO. (mm) SC1 SC2 SC2- SC1
8
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
9
Sl. Displacement Output of LVDT
NO. (mm) SC1 SC2 SC2- SC1
10
Results :
Linearity: --------------------
Sensitivity :----------------------------
Inference:
11
Anderson‟s Bridge
12
Exp. No. 3 ANDERSON‘S BRIDGE
OBJECTIVE:
APPARATUS REQUIRED:
3. Multimeter ---- 1
THEORY:
Inductance is the electrical property, which opposes any change in the magnitude of current in a
circuit. Devices, which are used to provide the inductance in a circuit, are called inductors. (Also
known as chokes, reactors and coils)
The inductance of an inductor is called self-inductance. It is given this name because the inductor
induces voltage in itself. That is, its own changing magnetic field induces voltage in its own
turns of wire.
When the magnetic flux from one conductor induces a voltage in another, electrically isolated
conductor, it is called mutual inductance. With mutual inductance, circuits that are electrically
isolated can be magnetically coupled together. The value of a capacitor or an inductor can be
determined with an ac bridge.
13
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
14
Let, L1 = Self inductance to be measured.
1
I1R3 Ic
j C
At balance I1 = I3 and I2 = IC + I4
I1 ( r1 + R1 + j L1 ) = I2 R2 + IC r ---------------------( a )
And Substituting the value of IC in equation a and equating real and imaginary parts
1
Ic r I 2 R4 IcR4
j C
R2 R3 R3
R1 r1 L1 C r R4 R2 R2 R4
R4 R4
To obtain easy convergence of balance alternate adjustments of r1 and R1 should be done.
PROCEDURE:
2. Switch ON the training board and the power supply and the output of the
oscillator ( 1 kHz sine wave in CRO )
15
Range between 25 mH to 500 mH
TABULAR COLUMN:
Inductance ( mH )
Model Graph:
Model Calculation
16
3. Keep r1 and r potentiometers minimum position by moving it in the anticlockwise
direction.
5. Vary the potentiometer r such that the amplitude of sine wave decreases and at
one point it will obtain minimum amplitude and then it will start increasing. At
this point stop tuning (when the sound is minimum) and now vary the
potentiometer r1 such that the amplitude of sine wave decreases and increases in
the same manner. Stop tuning when the amplitude is minimum
6. Remove the patching at r and note down the value of r using multimeter and
R3
L1 C R 100 R4 R2 R2 R4 henries
R4
measure the inductance using LCR meter (i. e. True value)
7. The self inductance of the coil is calculated using the formula (measured value)
Result:
17
Bridge Diagram
E1 E3
E
I1
I1 RX
R2
CX
D I2
C3 C1
I2
IC
R1
IR
Phasor Diagram
I2
IC
c
I4
E3 = R2 I1
I1RX I1
E4 =
IC/ C1=IRR1
I1/ C X
E
18
Exp. No. 4 SCHERING BRIDGE
OBJECTIVE:
To find the capacitance of the unknown capacitors and its dissipation factor.
APPARATUS REQUIRED:
S. No Item Quantity
Specification
3. Multimeter ---- 1
THEORY:
The ability to store energy in the form of electric charge is called capacitance. A device
designed to possess capacitance is called a capacitor. In its simplest form a capacitor is
nothing more than two conductors separated by an insulator. The relative amount of energy
lost in a capacitor can be indicated by any of the three terms - the terms being dissipation
factor, power factor and quality factor. All these terms give about the same information.
Power factor is the ratio of power to apparent power. In a capacitor power represents the
energy per second lost and apparent power represents the energy per second stored. If a
capacitor has very little energy loss, its power factor is low. Quality Q is the ratio of
reactance to resistance. If a capacitor has very little energy loss, R is low and Q is high.
19
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
20
factor and power factor. The value of a capacitor or an inductor can also be determined with
an ac bridge.
R2 = A non-inductive resistance
C1 = A variable capacitor
At balance,
1 R2 1 j C1R1 1 R2 R2C1
Rx Rx
j Cx j C3 R1 j Cx j C3 R1 C3
R2C1 C3 R1
Rx Cx
C3 R2
D= C1R1
21
Range .9 µF – 2.1µF
Tabular Column:
Model Graph
MODEL CALCULATION:
22
PROCEDURE:
4. Connect the CRO across position P and Q and switch ON the unit
6. Vary the potentiometer R4 such that the amplitude of sine wave decreases
and at one point it will obtain maximum to zero amplitude and then it
will start increasing, stop tuning at that point and vary R3 Here also
amplitude of sine wave decreases and at one point it will start increasing,
stop tuning R3
7. Repeat the above such that zero amplitude is obtained under both
conditions
RESULT:
True or false: Electrons travel from one plate through the dielectric to the other
plate when a capacitor is charged.
Does air have a smaller or larger dielectric constant than other common dielectric
materials used in making capacitors?
23
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
24
Exp. No. 5 CALIBRATION OF WATTMETER
OBJECTIVE:
To calibrate the given wattmeter by direct loading method.
APPARATUS REQUIRED:
THEORY:
Wattmeter is an instrument to measure the power consumed directly. In the direct method a
standard ammeter and voltmeter are used to calculate the true power. There are two ways of
connecting a wattmeter as shown in figures 1.2.1 and 1.2.2
If the load current is small, the voltage drop in the current coil is small so the connection of
Figure 1.2.1 introduces very small error. On the other hand, if the load current is large, the value
of pressure coil current is very small as compared with the load current and hence the power loss
in the pressure coil will be very small as compared with load power and therefore connection of
figure 1.2.2 is preferable.
However if accuracy requires that power loss in the instrument to be taken into account,
connection 1.2.2 is preferable. This is because for a constant voltage, the power loss V2/Rp in
the pressure coil circuit is constant. Here calibration involves comparing the wattmeter reading
with the true power obtained from Ammeter and voltmeter reading
25
TABULAR COLUMN:
UNLOADING
Model Graph
+ve
% Error
Wattmeter reading in Watts
-ve
26
CC
PC
SUPPLY
V
Fig 1.2.2
PRECAUTIONS: Before closing DPST switch,
1. Auto transformer should be in the minimum voltage position.
RESULT:
3. What is calibration?
27
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
28
Exp. No. 6 CALIBRATION OF ENERGY METER BY USING DIRECT
LOADING METHOD
OBJECTIVE:
APPARATUS REQUIRED:
1. Ammeter ( 0 – 10 A ) MI 1
2. Voltmeter ( 0 – 300 V ) MI 1
3. Wattmeter 300 V , 10 A , UPF 1
4. Stopclock ----- 1
THEORY:
The watt-hour meter is an instrument used for measuring energy. As energy is the product of
power and time; the watt-hour meter must take into consideration both of these factors. Induction
type of energy meters are universally used for measurement of energy in domestic and industrial
AC circuits. The term testing includes the checking of the actual registration of the meter as
well as the adjustments done to bring the errors of the meters within the prescribed limits.
Direct loading method is similar to the one explained in the calibration of wattmeter. Here a
standard wattmeter is used for comparing the values. When the capacity of a meter under test is
high, a test with the ordinary loading arrangements would involve a considerable waste of power.
To avoid this ―phantom or fictitious‖ loading arrangements are employed. These consist in
supplying the pressure circuit from a circuit of the required normal voltage, and the current
circuit from a separate low voltage supply. This means that the total power supplied for the test is
that due to the small pressure coil current at normal voltage plus that due to the load current at a
low voltage and the total power is therefore only a comparatively small amount.
29
TABULAR COLUMN
3 20
4 25
5 30
6 35
MODEL CALCULATION:
MODEL GRAPH:
Percentage error
Measured energy
30
PRECAUTIONS:
Before closing DPST switch,
1. Auto transformer should be in minimum voltage position.
2. All the loads should be in ‗OFF‘ position.
PROCEDURE: Direct loading method:
1. Make the connections as shown in figure
2. After closing the DPST switch adjust the auto-transformer to the specified
voltage of the energy meter.
3. Switch ‗ON‘ some specific load. Take Ammeter, Voltmeter and wattmeter
readings. Also note down the time taken by energy meter disc to complete a
specified number of revolutions using stop clock.. This is repeated for
different load condition.
4. True energy is calculated by multiplying the wattmeter reading and the time.
5. Recorded energy is obtained using energy meter constant and no. of
revolution.
6. Results are tabulated (Refer Table) and a graph between percentage error and
True energy is drawn.
31
Formulae Used:
Wattmeter reading * time
True energy = KwH
60*60*1000
No. of Blinkings
Recorded Energy = KwH
Energy meter constant
32
TYPICAL PROBING QUESTIONS:
RESULT:
33
CYCLE - II
LabVIEW
34
Introduction To Lab VIEW
Front Panel
• Controls = Inputs
• Indicators = Outputs
Block Diagram
• Accompanying “program” for front panel
• Components “wired” together
35
VI Front Panel
VI Block Diagram
36
Control Palette ( Front Panel window)
Tool Palette
37
Automatic Selection Tool
38
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
39
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
40
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
41
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
42
Exp. No.1 Developing a VI for simple applications
Arithmetic operations using Lab View (using two inputs)
Objective:
To implement the arithmetic operations using Lab view
Operation:
For addition; X+Y= Result
For subtraction; X-Y= Result
For Multiplication; X*Y= Result
For division; X/Y= Result
Algorithm:
43
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
44
Exercises: a Build a VI to add and multiply more than two inputs.
b Build a VI to find the average of two numbers.
c Build a VI to find the slope between two points.(x1,x2) &(y1,y2)
y2 y1
Hint: slope =
x2 x1
d Build a VI that converts centigrade to Fahreint.
1.8* °C + 32 = ° F
Result
The arithmetic operations are implemented using Lab VIEW
45
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
46
Exp. No. 2 Realization of Boolean logic
Objective:
To build a VI that implements AND, OR, NAND, NOR, XOR, XNOR gates for two
logical inputs A, B
Operation:
AND gate: A*B
OR gate : A+B
NAND gate: /A. /B
NOR gate: /A+/B
XOR gate: A.(/B) +(/A).B ( where /A and /B represents a NOT A and NOT B. )
XNOR gate: AB + /AB
Algorithm:
Step1: Create two toggle switches as in put A, B in the front panel
Step2: Create a LED as an indicator in the front panel
Step3: Create AND gate in the block diagram.
Step 4: wire the switches and LEDs to the gate inputs.
Step5: Run the program and verify the truth table.
Step6: Repeat the above steps using OR, NOR, XNOR, XOR, NAND gate and verify the
truth table.
47
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
48
Sample Input and Output:
Exercises: a Build a VI to AND and OR function using more than two inputs
b Build a VI to compare two numbers if it is greater-LED ON
c Build a VI to find whether the given number is
Even –LED On
Odd –LED OFF
Result:
49
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
50
2.b Waveform generation and charts
Lab VIEW includes the following types of graphs and charts:
a. Waveform Graphs and Charts—Display data typically acquired at a constant rate.
b. XY Graphs—Display data acquired at a non-constant rate and data for multivalued
functions.
c. Intensity Graphs and Charts—Display 3D data on a 2D plot by using color to
display the values of the third dimension.
d. Digital Waveform Graphs—Display data as pulses or groups of digital lines.
e. Windows 3D Graphs—Display 3D data on a 3D plot in an ActiveX object on the
Front panel.
Waveform Graphs
The waveform graph displays one or more plots of evenly sampled measurements. The
waveform graph plots only single-valued functions, as in y = f(x), with points evenly distributed
along the x-axis, such as acquired time-varying waveforms
(i) Displaying a Single Plot on Waveform Graphs
(ii) Displaying Multiple Plots on Waveform Graphs
Waveform Charts
The waveform chart is a special type of numeric indicator that displays one or more plots of data
typically acquired at a constant rate. The waveform chart maintains a history of data, or buffer,
from previous updates. The default chart history length for a waveform chart is 1,024 data points.
The frequency at which we send data to the chart determines how often the chart redraws.
(i) Displaying a Single Plot on Waveform Charts
(ii) Displaying Multiple Plots on Waveform Charts
XY Graphs
The XY graph is a general-purpose, Cartesian graphing object that plots multivalued functions,
such as circular shapes or waveforms with a varying time base. The XY graph displays any set of
points, evenly sampled or not. The XY graph can display plots containing any number of points.
The XY graph also accepts several data types, which minimizes the extent to which you must
manipulate data before you display it.
(i) Displaying a Single Plot on XY Graphs
(ii) Displaying Multiple Plots on XY Graphs
Intensity Graphs and Charts
Use the intensity graph and chart to display 3D data on a 2D plot by placing blocks of color on a
Cartesian plane. For example, an intensity graph or chart can be used to display patterned data,
such as temperature patterns and terrain, where the magnitude represents altitude. The intensity
51
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
52
graph and chart accept a 3D array of numbers. Each number in the array represents a specific
color. The indexes of the elements in the 2D array set the plot locations for the colors.
Intensity Charts
After you plot a block of data on an intensity chart, the origin of the Cartesian plane shifts to the
right of the last data block. When the chart processes new data, the new data values appear to the
right of the old data values. When a chart display is full, the oldest data values scroll off the left
side of the chart. This behavior is similar to the behavior of a strip chart.
Intensity Graphs
The intensity graph works the same as the intensity chart, except it does not retain previous data
values and does not include update modes. Each time new data values pass to an intensity graph,
the new data values replace old data values. Like other graphs, the intensity graph can have
cursors. Each cursor displays the x, y, and z values for a specified point on the graph.
Using Color Mapping with Intensity Graphs and Charts
An intensity graph or chart uses color to display 3D data on a 2D plot. When you set the color
mapping for an intensity graph or chart, you configure the color scale of the graph or chart. The
color scale consists of at least two arbitrary markers, each with a numeric value and a
corresponding display color. The colors displayed on an intensity graph or chart corresponds to
the numeric values associated with the specified colors. Color mapping is useful for visually
indicating data ranges, such as when plot data exceeds a threshold value.
Digital Waveform Graphs
Use the digital waveform graph to display digital data, especially when you work with timing
diagrams or logic analyzers. The digital waveform graph accepts the digital waveform data type,
the digital data type, and an array of those data types as an input. By default, the digital
waveform graph collapses digital buses, so the graph plots digital data on a single plot. If you
wire an array of digital data, the digital waveform graph plots each element of the array as a
different plot in the order of the array.
Digital Waveform Data Type
The digital waveform data type carries start time, delta x, the data, and the attributes of a digital
waveform. You can use the Build Waveform function to create a digital waveform. When you
wire digital waveform data to the digital waveform graph, the graph automatically plots a
waveform based on the timing information and data of the digital waveform. Wire digital
waveform data to a digital data indicator to view the samples and signals of a digital waveform.
3D Surface Graph—Draws a surface in 3D space.
3D Parametric Surface Graph—Draws a parametric surface in 3D space.
3D Curve Graph—Draws a line in 3D space.
Exercises:
a. Build a VI to generate a sine wave using simulate signal express VI. Change the
waveform properties like amplitude and frequency and plot in a waveform graph
b. Build a VI to plot a circle in the XY graph using For loop.
53
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
54
Exp. No. 3 Creating Sub VIS
Objective:
Operations:
Slope of line = (Y2 – Y1) / (X2 – X1)
Procedure/ Algorithm
Creating a SUB VI
1. The first step in creating a Sub VI is to modify it's icon so that it can be recognized when it is
used in an upper-level VI. Every VI has a default icon in the upper-right corner of both the Front
Panel and the Block Diagram.
55
Icon Editing Tools
Line - Draws straight lines. Hold down the shift key to draw
vertical, horizontal or diagonal lines.
Text - Enters text into the icon editing area. If you double-click
on this tool, you can select different fonts and font sizes.
56
The largest area is where the default icon. This is where the icon is edited using the Editing
Tools (Explained in detail below). The Menu Bar contains standard editing options like Undo,
Redo, Cut, Copy, Paste, etc. By Default the Display Mode is set to 256 Colors which is most
commonly used (using a monochrome display).
The next step in creating a Sub VI is to assign the icon connectors to the appropriate
57
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
58
Front Panel Controls and Indicators. This will allow Controls and Indicators in the Upper-level
VI to wire to the Sub VI.
The Icon will change to show all of its connectors. In this case, our example looks like this:
It has four connectors on the left and one on the right. The four connectors on the left will be the
data-input wire hot spots for the four required Front Panel Controls. The connector on the left
will be the data-output wire hot spot for the Front Panel Indicator. The connectors to the
appropriate Controls and Indicators are assigned. This is done using the Connect Wire Tool on
the Tools Palette. After the Connect Wire Tool is selected, click on an icon connector and then
click on it's respective Control or Indicator on the Front Panel. The icon connector should
become dark. Repeat this process until all of the connectors have been assigned their respective
Controls or Indicators. Be careful of the order of your selection. It will determine how the Sub
59
An Open File window to open any VI. Select the desired Sub VI and place it's icon on the Block
Diagram. Then wire it's connectors to the appropriate Control and Indicator terminals:
60
VI is wired in the upper-level VI. When you are done, all connectors on the icon representation
should be dark.
4. Using a Sub VI
Using a Sub VI in an upper-level VI .for example to employ the Slope Function VI in another
VI called Slope_Function_Sub.vi
After the upper-level VI is created and added all of the necessary Controls and Indicators, add
the Sub VI to the Block Diagram by popping-up > Functions >
Select A VI:
Exercise:
a. Create a SUBVI for finding the slope between two points
b. Create a SUBVI to convert centigrade two Fahrenheit
61
FOR loop using Lab view
62
Exp. No. 4 Iterative Data Transfer Using For, While Loops, Shift
Registers
(i) Factorial of a number using For and While loop
Aim
To find the factorial of a number using For loop
Algorithm:
Step1: Create a numeric control in the front panel and connect to the count terminal N of
the FOR Loop.
Step2: Create the shift registers on the input and output border of the FOR loop and initialize the
value as 1 in the input..
Step3: Increment the iteration terminal; wire it as one of the input to the multiplication
And other input is from the shift register
Step 4: wire the multiplication output to the output shift register
Step5: Create an indicator at the output terminal of the shift register
Step 6: Run the program and get the factorial of a number.
Sample Input and Output
Factorial of 7 =7*6*5*4*3*2*1 = 5040
Operations:
Shift resistor constant = 0
i = i+0
If I >10 : stop and give the result
Algorithm:
63
While loop using Lab view
Two
differ
ent
types
of
termi
natin
g
conditions can be set:
Stop if True (default setting) – When using this condition, the while loop will run
until a certain condition is met
Continue if True – When using this condition, the while loop will run until a certain
condition is no longer satisfied or true.
(Right-Click on the stop sign terminal and select Continue If True)
Iteration Terminal – The iteration terminal will keep record of how much iteration
have been completed. The iteration count always begins from 0, so during the first
iteration, the output from the iteration terminal will be 0.
64
Sample input ant output
Exercises:
a. Build a VI to find the sum of first 10 natural numbers using FOR loop and while
loop 1 + 2+ 3+ 4+ 5+ 6+ 7+ 8+ 9+ 10.
b Build a VI to find the factorial of a number using while loop.
c. Build a VI that changes the color of the color box automatically.
Result:
65
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
66
Exp. No. 5 Decision making with Case structure
A Case structure has two or more sub diagrams, or cases. Only one sub diagram
is visible at a time, and the structure executes only one case at a time. An input
value determines which sub diagram executes. The Case structure is similar to
case statements or if...then...else statements in text-
based programming languages.
The case selector identifier at the top of the Case structure contains the case
selector identifier in the center and decrement and increment buttons on each side. The
decrement and increment buttons are used to scroll through the available cases. An input
value, or selector, is wired to the selector terminal to determine which case to
execute. An integer, Boolean value, string, or enumerated type value is wired to the
selector terminal. The selector terminal can be positioned to anywhere on the left border
of the Case structure. If a Boolean is wired to the selector terminal, the structure has a
True case and a false case. If an integer, string, or enumerated type value is wired to the
selector terminal, the structure can have up to 231−1 cases. A default case to handle out-
of-range values or explicitly every possible input values are specified. For example, if the
cases for 1, 2, and 3 are specified but if an input of 4 is specified then the Case structure
executes the default case.
Operation
67
Prepared by Prof. S. Vivekanandan & Prof. P. Vijayapriya
68
Algorithm:
Exercises:
a. Create VI consisting of numeric array with even and odd elements. Separate the
odd and even elements as two different arrays.
b Build a VI to find the square root of a given number .If the given number is a
negative number display the message as ―Error …The number is negative‖
c. Build a VI using case structure to switch between additions, subtraction,
Multiplication, division of two numbers.
Result:
69