Instrumentation Lab # 03: Local Variables, Global Variables and Phase Locked Loop: Objective
Instrumentation Lab # 03: Local Variables, Global Variables and Phase Locked Loop: Objective
Name: -
Roll #:-
Section: -
Date:-
Theory:
Example:In the above program, we have created a local variable of STOP Button to control both while loops. Since
without Local variable, both loops will run independently but now with one STOP button, we will stop
the both while loops.
In a similar fashion, we can create Local Variable of any control or indicator.
Project Explorer Window:Use the Project Explorer Window to create and edit projects. Select FileNew Project to
display the Project Explorer Window. You also can select ProjectNew Project or select
FileNew and then select Empty Project in the new dialog box to display the Project Explorer
Window.
Shared Variables:
Variable types:
Single process: Share the data among VIs on the local computer
Example:Create Two VIs one for a switch and other for LED. If we press a switch in One VI, it will light up
the LED in other VI.
Solution:First of all, create two VIs of name Switch and LED. Place a Switch and an LED in the respective
VI. Then go to project and click on New Project, the following window will open, click on Add
and proceed.
After clicking Add, another window will open which is as follows, Then go to file and click on
Save As, by First Project, then perform the following functions
Right click on My Computer, go to New, then click on Variable, the following window will open,
Change the Name of shared variable` to LED_Switch, select the Variable Type as Singl Process,
also select the Data Type as Boolean as both LED and Switch belongs to Boolean Data Type.
Then click on Ok.
Now, right click on Untitled Library 1in the Project Explorer Window and click on save option,
and save as First_Project_Library. The Project Explorer Window now looks like as follows.
Now, drag the LED_Switch variable which has green icon in the Project Explorer Window and
place it on the both VIs , the LED VI as well as the Switch VI. Now right clikc on LED_Switch
shared varible which is placed in the Switch VI and change to Write, then make the following
connection.
The Front Panel after running the program looks like as shown above
Phase Locked Loop:A phase-locked loop or phase lock loop (PLL) is a control system that generates an output signal whose
phase is related to the phase of an input "reference" signal. It is an electronic circuit consisting of a
variable frequency oscillator and a phase detector. This circuit compares the phase of the input signal
with the phase of the signal derived from its output oscillator and adjusts the frequency of its oscillator
to keep the phases matched. The signal from the phase detector is used to control the oscillator in a
feedback loop.
In LabView, we can generate the PLL as follows, The Front Panel is shown below in which we have two
waveforms, one is input signal in which user defines the Phase of this very signal with a knob while the
other signal come from the oscillator output, Here, the phase knob defined in the Front Panel is used to
tune the phase of the input signal which is represented with the Red color whereas the white signal
came from the oscillator whose input is taken from the Shift Register.
Important point here is that the frequency and gain of both the signals must be same in order to lock
the phase. The Meter shown at the right bottom is used to show the Phase Difference of both the
signals. This is basically a phase detector.
There are two cases. If the phase difference of two signals is greater than zero, it means that we have to
reduce this phase difference up to zero in order to lock the desired phase. In second case, if the phase
difference is less than zero, it should be increased upto zero in order to lock the desired phase. This can
be illustrated in the following Block diagram as follows.
Lab Task # 01:Make a program with 2 while Loops, with one loop contains just two controls (First Number and Second
Number) and the other loop contains just an indicator (Answer) in it. We have to multiply 2 input
numbers and stop the program with only One STOP Button. Paste the running VI snapshot here. The
Front Panel will look like as
Lab Task # 02:Implement the Phase Locked Loop Program as discussed in the Lab and get the wave form as shown
above. Paste the snapshot of running VI.