OneStopGate.Com
OnestopGate   OnestopGate
   Friday, May 3, 2024 Login  
OnestopGate
Home | Overview | Syllabus | Tutorials | FAQs | Downloads | Recommended Websites | Advertise | Payments | Contact Us | Forum
OneStopGate

GATE Resources
Gate Articles
Gate Books
Gate Colleges 
Gate Downloads 
Gate Faqs
Gate Jobs
Gate News 
Gate Sample Papers
Training Institutes

GATE Overview
Overview
GATE Eligibility
Structure Of GATE
GATE Coaching Centers
Colleges Providing M.Tech/M.E.
GATE Score
GATE Results
PG with Scholarships
Article On GATE
Admission Process For M.Tech/ MCP-PhD
GATE Topper 2012-13
GATE Forum




GATE 2025 Exclusive
Organizing Institute
Important Dates
How to Apply
Discipline Codes
GATE 2025 Exam Structure

GATE 2025 Syllabus
Aerospace Engg..
Agricultural Engg..
Architecture and Planning
Chemical Engg..
Chemistry
Civil Engg..
Computer Science / IT
Electronics & Communication Engg..
Electrical Engg..
Engineering Sciences
Geology and Geophysics
Instrumentation Engineering
Life Sciences
Mathematics
Mechanical Engg..
Metallurgical Engg..
Mining Engg..
Physics
Production & Industrial Engg..
Pharmaceutical Sciences
Textile Engineering and Fibre Science

GATE Study Material
Aerospace Engg..
Agricultural Engg..
Chemical Engg..
Chemistry
Civil Engg..
Computer Science / IT
Electronics & Communication Engg..
Electrical Engg..
Engineering Sciences
Instrumentation Engg..
Life Sciences
Mathematics
Mechanical Engg..
Physics
Pharmaceutical Sciences
Textile Engineering  and Fibre Science

GATE Preparation
GATE Pattern
GATE Tips N Tricks
Compare Evaluation
Sample Papers 
Gate Downloads 
Experts View

CEED 2013
CEED Exams
Eligibility
Application Forms
Important Dates
Contact Address
Examination Centres
CEED Sample Papers

Discuss GATE
GATE Forum
Exam Cities
Contact Details
Bank Details

Miscellaneous
Advertisment
Contact Us


Home » GATE Study Material » Electrical Engineering » Measurements » Loops in LabVIEW

Loops in LabVIEW (Timing the loop!)

Looking for GATE Preparation Material? Join & Get here now!

** Gate 2013 Question Papers.. ** CEED 2013 Results.. ** Gate 2013 Question Papers With Solutions.. ** GATE 2013 CUT-OFFs.. ** GATE 2013 Results.. **

Loops in LabVIEW (Timing the loop!)

An Introduction To Using LabView - 2 - A Timed Loop

        In the first LabVIEW note we examined some simple arithmetic operations in LabVIEW.  In this note we will examine how to write a simple program with a timed loop.  After all, it isn't enough just to do arithmetic.  In most applications you need to do calculations over and over again.  Repetitive calculations are best done using a timed loop.

        Timed loops are important because you often encounter situations where you want to take measurements repetitively at a constant time interval.  Timed loops let you take data where you can set the timing between measurements.  Before getting to timed loops, we will walk you through some simple loops, and we will end with some timed loops that generate and display sinusoidal signals.

        In this note - as in the other LabVIEW notes, you could just read through the note, but you will do better if you work along as we discuss what is happening.

        The first thing you are going to do is to construct a simple timed loop.   You need to do the following.

  • Start LabView.  Choose New vi.

  • We will use some of routines that we have written previously.  You will need to have the Diagram window active.  Choose Window-Show Diagram if the diagram is not active and showing.

  • Choose Window-Show Functions Palette.  The Functions palette is shown below.

  • On the Functions palette locate the Structures menu (top left) and click to get options.  As you put the cursor over the different menus, a small pop-up window lets you know what the menu contains.

    • Place a While Loop on the Block Diagram.

    • This is what you get.  Make it at least this size.

    • You should notice an iteration counter (i) and a Loop Stop Conditional Terminal.  The while loop executes as long as the Conditional Terminal is true - although you can change that yourself.

      • To change the conditional terminal to look like the one above in the lower right corner - if it happens to look like a little stop sign - right mouse click on the icon and set to Continue if True.

  • We will write a loop that executes for a number of times that you specify - eventually.  But for now, we are going to add a few things to make this run.  First try to run the vi.  You should get an error message that the conditional terminal is not wired.  That's not the only problem - but it is the problem that you will fix first.

  • To start, go to the Front Panel, and add a Numeric Indicator from the Numeric menu.  When you have the numeric indicator on the front panel, right click the indicator and choose Find Terminal.  You will be taken to the diagram and the terminal will be evident.  Note that adding the indicator on the front panel automatically adds a terminal for the indicator to the diagram.  There are some components that can only be added - or deleted - from the front panel or the diagram - even though they must appear on both.

    • Move the terminal inside the while loop.

    • Change the representation to an integer format.  The control should be blue when you have it right.  (Blue indicates an integer.)

  • Now, add a constant to the Conditional Terminal by right-clicking on the terminal to add a constant.  Make that constant equal to True using the hand tool.

        At this point, your block diagram should look like this.
  • Now, you can run the program.  All that happens is that the indicator shows the loop counter - and it will show that each loop takes very little time!

  • As the numbers on the indicator rapidly zip by, hit the Stop button (looks like a stop sign) just under the menu.

        That's your first excusion into the world of loops.  The loop you wrote should have executed very rapidly and should have displayed a rapidly increasing number in the indicator on the front panel.  We can now add a timer to the loop to control how rapidly it executes.
  • Next, we will set the timing of the loop execution.

    • On the time menu select the timer with a metronome icon and place it inside the loop

    • Right click the timer to add a constant.  Make that constant equal to 1000 (That's 1000 milliseconds!) using the text tool.

    • Your diagram should look like this.  (Except that in generating the picture below, we may have lost the wire going from the TRUE constant to the conditional terminal.  That wire should be there.  It is just not showing in the picture.)

        At this point you have a loop that is timed, and since the input to the timer is 1000 (that's milliseconds) it always runs at 1 second intervals.  There are two things we want to do to improve this program.

  • We want to be able to set the time interval (in seconds).

  • We want to display the elapsed time (in seconds).

        We will take care of those two concerns next.
  • To set the time interval, you need to add a numeric control on the front panel.  Do that now.  NOTE:  You need to use a control that permits floating point inputs if you want to time the loop at intervals like 1.5 seconds.  Add that control now.

  • After adding the control, right mouse click on the control and locate the terminal for the numeric control you just added.

  • Then you need to wire the control so that it controls the input to the timer block.  Up above we just used a constant of 1000 to get one second.  If you input the time interval in seconds, you will need to multiply the time interval that the user inputs by a factor of 1000 (to get the timer interval in milliseconds), so you will need a multiplier and a constant input to one side of the multiplier equal to 1000.

Now, your block diagram should look something like this.
  • Now, run your program.  Of course, the only thing this program does is to tell you how long it has been running.  It's pretty useless unless you use it as an egg timer.


Problems

P1      Modify the program above so that you can stop the program using an ON-OFF control.  Here's a hint.  Try replacing the constant the is wired to the conditional terminal with a control.  Right-click the constant (set to TRUE in the block diagram above) and change it to a control.  Then find the control on the front panel.



        One final program - just to end this by producing something that's getting close to useful.  (The next lesson in this series will take you to the world of IEEE-488 (GPIB) measurements, and when you put them in a loop, then you have some interesting things that you can do.)  Anyhow, this last program will compute a sine wave and display it on the dial.  Here is the block diagram.

You should notice the following in this block diagram.

  • In the previous vi we computed the elapsed time and displayed it on the front panel.  Here we take that time and multiply it by a factor that is 2pf.

    • The 2pfactor is a constant built into LabVIEW.  You can find it on the panel of numeric operations, and you should check out all of the other constants available.

  • The result of the multiplications is the input to a sine function.  You can find that function on the numeric palette of functions in a sub-palette of trigonometric functions.  Check out what else is there as well.

  • Finally, the output of the sine function is displayed on a Meter indicator.  That indicator has a front panel portion, and you should add it from the front panel.

  • Actually, the front panel looks like this when you are done.



Discussion Center

Discuss/
Query

Papers/
Syllabus

Feedback/
Suggestion

Yahoo
Groups

Sirfdosti
Groups

Contact
Us

MEMBERS LOGIN
  
Email ID:
Password:

  Forgot Password?
 New User? Register!

INTERVIEW EBOOK
Get 9,000+ Interview Questions & Answers in an eBook. Interview Question & Answer Guide
  • 9,000+ Interview Questions
  • All Questions Answered
  • 5 FREE Bonuses
  • Free Upgrades
GATE RESOURCES
 
  • Gate Books
  • Training Institutes
  • Gate FAQs
  • GATE BOOKS
     
  • Mechanical Engineeering Books
  • Robotics Automations Engineering Books
  • Civil Engineering Books
  • Chemical Engineering Books
  • Environmental Engineering Books
  • Electrical Engineering Books
  • Electronics Engineering Books
  • Information Technology Books
  • Software Engineering Books
  • GATE Preparation Books
  • Exciting Offers



    GATE Exam, Gate 2009, Gate Papers, Gate Preparation & Related Pages


    GATE Overview | GATE Eligibility | Structure Of GATE | GATE Training Institutes | Colleges Providing M.Tech/M.E. | GATE Score | GATE Results | PG with Scholarships | Article On GATE | GATE Forum | GATE 2009 Exclusive | GATE 2009 Syllabus | GATE Organizing Institute | Important Dates for GATE Exam | How to Apply for GATE | Discipline / Branch Codes | GATE Syllabus for Aerospace Engineering | GATE Syllabus for Agricultural Engineering | GATE Syllabus for Architecture and Planning | GATE Syllabus for Chemical Engineering | GATE Syllabus for Chemistry | GATE Syllabus for Civil Engineering | GATE Syllabus for Computer Science / IT | GATE Syllabus for Electronics and Communication Engineering | GATE Syllabus for Engineering Sciences | GATE Syllabus for Geology and Geophysics | GATE Syllabus for Instrumentation Engineering | GATE Syllabus for Life Sciences | GATE Syllabus for Mathematics | GATE Syllabus for Mechanical Engineering | GATE Syllabus for Metallurgical Engineering | GATE Syllabus for Mining Engineering | GATE Syllabus for Physics | GATE Syllabus for Production and Industrial Engineering | GATE Syllabus for Pharmaceutical Sciences | GATE Syllabus for Textile Engineering and Fibre Science | GATE Preparation | GATE Pattern | GATE Tips & Tricks | GATE Compare Evaluation | GATE Sample Papers | GATE Downloads | Experts View on GATE | CEED 2009 | CEED 2009 Exam | Eligibility for CEED Exam | Application forms of CEED Exam | Important Dates of CEED Exam | Contact Address for CEED Exam | CEED Examination Centres | CEED Sample Papers | Discuss GATE | GATE Forum of OneStopGATE.com | GATE Exam Cities | Contact Details for GATE | Bank Details for GATE | GATE Miscellaneous Info | GATE FAQs | Advertisement on GATE | Contact Us on OneStopGATE |
    Copyright © 2024. One Stop Gate.com. All rights reserved Testimonials |Link To Us |Sitemap |Privacy Policy | Terms and Conditions|About Us
    Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | India Job Forum | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Free Classifieds | Jobs Assist | Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Web Hosting | Quick Site Kit | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Software Testing Interview Questions | Free Online Exams | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World
    C Interview Questions | C++ Interview Questions | Send Free SMS | Placement Papers | SMS Jokes | Cool Forwards | Romantic Shayari