0% found this document useful (0 votes)
47 views8 pages

Instrumentation Lab # 03: Local Variables, Global Variables and Phase Locked Loop: Objective

This document discusses local and global variables in LabVIEW, and implementing a phase locked loop. It explains that local variables allow communication between loops that otherwise run independently. Global variables stored in a project library allow sharing data between VIs running on the same or different computers. The document provides an example of using a shared variable to control an LED from a switch in separate VIs. It also explains how to generate a phase locked loop in LabVIEW using a variable frequency oscillator, phase detector, and feedback loop to match the phase of an input reference signal.

Uploaded by

Fakhar Abbas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views8 pages

Instrumentation Lab # 03: Local Variables, Global Variables and Phase Locked Loop: Objective

This document discusses local and global variables in LabVIEW, and implementing a phase locked loop. It explains that local variables allow communication between loops that otherwise run independently. Global variables stored in a project library allow sharing data between VIs running on the same or different computers. The document provides an example of using a shared variable to control an LED from a switch in separate VIs. It also explains how to generate a phase locked loop in LabVIEW using a variable frequency oscillator, phase detector, and feedback loop to match the phase of an input reference signal.

Uploaded by

Fakhar Abbas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Instrumentation Lab # 03

Name: -

Roll #:-

Section: -

Date:-

Local Variables, Global Variables and Phase Locked Loop:


Objective:

To understand why do we use local and global variables in LabView


Implement Phase Locked Loop in LabView

Theory:

Communication between loops using data flow is not possible.


The left loop executes completely the before the right loop.
Variables are needed when
communication with wires does not
give the desired behavior.
There is no way to communicate
between parallel loops using data flow.
Data cannot enter or leave a structure
while it is still running via data flow.
Variables are Block diagram elements
that you use to access or store data in another location.

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.

Global Variables: Communication between Two VIs


Use projects to group together LabVIEW and other files, create build specifications, and deploy
or download files to targets. A target is a device or machine on which a VI runs. When you save
a project, LabVIEW creates a project file (.lvproj), which includes configuration information,
build information, deployment information, and references to files in the project.
You must use a project to build stand-alone applications and shared libraries. You also must use
a project to work with a Real-Time, FPGA, or PDA target. Refer to the specific module
documentation for more information about using projects with the LabVIEW Real-Time,
LabVIEW FPGA, and LabVIEW Mobile Module.
Project-style LabVIEW Plug and Play instrument drivers use the project and project library
features in LabVIEW 8.6. You can use project-style drivers in the same way as previous LabVIEW
Plug and Play drivers.

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:

LabVIEW shared variables are used to send data between VIs

Variable types:

Single process: Share the data among VIs on the local computer

Network-published: Communicate between VIs, remote computers, and


hardware through the LabVIEW shared variable engine

Shared variables must exist within a project library

Shared variables must be deployed to be available to other projects and remote


computers

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.

You might also like