Table 1. Inputs and Outputs

Similar documents
Lesson 4 Implementing a VI

Step-by-Step Data Acquisition Part II Exercise 2: Generating an Analog Output Waveform

Read Temperature Data

A. Front Panel Design Lesson 4 Implementing a VI

Concept: Debugging. Goal. Description. Implementation. Use the debugging tools built into LabVIEW.

OpenStax-CNX module: m Thermometer VI * National Instruments

Getting Started with LabVIEW Virtual Instruments

Hardware: Acquiring Data and Communicating with Instruments

Introduction to LabVIEW

ECE 463 Lab 1: Introduction to LabVIEW

LabVIEW Express VI Development Toolkit User Guide

PHYC 500: Introduction to LabView. Exercise 8 (v 1.3) M.P. Hasselbeck, University of New Mexico. Arrays, XY Graphs, Disk I/O

Learn the three palettes. Learn how data is passed in LabVIEW. Create a subvi using two different methods.

NI LabView READ THIS DOCUMENT CAREFULLY AND FOLLOW THE INSTRIUCTIONS IN THE EXERCISES

Certified LabVIEW Associate Developer Exam. Test Booklet

Certified LabVIEW Associate Developer Exam. Test Booklet

Sample. LabVIEW TM Core 1 Exercises. Course Software Version 2010 August 2010 Edition Part Number B-01. LabVIEW Core 1 Exercises

Part 1. Creating an Array of Controls or Indicators

WELCOME TO LabVIEW 1

Shift Register: Exercise # 1: Shift Register Example VI. 1. Build the following front panel. Figure (8.1): Shift register exercise front panel

University of Pennsylvania. Department of Electrical and Systems Engineering. ESE Undergraduate Laboratory. Introduction to LabView

Lesson 1 Introduction to LabVIEW. TOPICS LabVIEW Environment Front Panel Block Diagram Dataflow Programming LabVIEW Help and Manuals Debugging a VI

LabVIEW VI Analyzer Toolkit

Tutorial: Getting Started with the LabVIEW Simulation Module

Certified LabVIEW Associate Developer Examination

Hands-on Lab 2: LabVIEW NI-DAQ Basics 2

Linear Control Systems LABORATORY

Lab 1: Getting familiar with LabVIEW: Part I

Getting Results with CompactRIO and LabVIEW

ME 365 EXPERIMENT 3 INTRODUCTION TO LABVIEW

Certified LabVIEW Associate Developer Examination

Lab Exercise 2: Data Acquisition with NI LabVIEW

Virtual Instrumentation With LabVIEW

Lab 4 - Data Acquisition

Virtual Instrumentation With LabVIEW

The LabVIEW Programming Environment and Basic Operations

Engineering Innovation Center LabVIEW Basics

Getting Started with the LabVIEW Real-Time Module

Small rectangles (and sometimes squares like this

CLAD Sample Exam 03. C. A control that output a cluster of the controls / indicators on the tabs.

LabVIEW TM Real-Time 2: Architecting Embedded Systems Exercises

Dept. of Electrical, Computer and Biomedical Engineering. Data Acquisition Systems and the NI LabVIEW environment

Above Threshold Warning of Temperature Data

NI-IMAQdx VI Reference Help

LabVIEW Real-Time Module Release and Upgrade Notes

Introduction to LabVIEW

LabVIEW Basics. Based on LabVIEW 2011 Student Edition

Exercise 0 - Open and Run a Virtual Instrument (Slide 12)

LabVIEW FPGA Module Release and Upgrade Notes

LabVIEW. Table of Contents. Lesson 1. Pre-reqs/Technical Skills Basic computer use

Getting Started with the LabVIEW Datalogging and Supervisory Control Module

LabView instrumentoinnissa, 55492, 3op Labview in instrumentation

LabVIEW VI Analyzer Toolkit

Exercise 5: Basic LabVIEW Programming

Getting Started with the NI LabVIEW Embedded Module for ADI Blackfin Processors Version 8.6

Exercise 7-1 Preparing Files for Distribution

Introduction to LabVIEW

Introduction to LabVIEW Exercise-1

To Create Multiple Columns in a Word Document

PHYC 500: Introduction to LabView. Exercise 1 (v 1.3) M.P. Hasselbeck, University of New Mexico

Getting Started with the LabVIEW Robotics Module Version 2011

Hands-on Lab 1: LabVIEW NI-DAQ Basics 1

Getting Started with the LabVIEW Datalogging and Supervisory Control Module

LabVIEW programming I

LabVIEW FPGA Module Release Notes

Introduction to LabVIEW. By Finn Haugen, TechTeach

LabVIEW basics. BME MIT János Hainzmann, Károly Molnár, Balázs Scherer, Csaba Tóth

Application State Machine

NAME EET 2259 Lab 3 The Boolean Data Type

NI-IMAQ VI Reference Help

LabVIEW & FRC. BAA Fall Education Day 2015

Getting Started with the LabVIEW Real-Time Module

C3D Data Shortcuts & References

EKT 314/4 LABORATORIES SHEET

A Practical Exercise for the ADC

GET130 Intro to Engineering Technology

LabVIEW programming I

Introduction to LabVIEW. Modified Powerpoint file taken from ma/courses/es110/

LabVIEW Real-Time Module Release Notes

FRC LabVIEW Sub vi Example

ENGR 1000, Introduction to Engineering Design

LabVIEW FPGA Module Release and Upgrade Notes

HPE IMC WSM Converged Topology Configuration Examples

File Storage Techniques in LabVIEW

LabVIEW. Getting Started with LabVIEW. Getting Started with LabVIEW

Controller Area Network (CAN) Tutorial

Getting Started Manual. SmartList To Go

National Instruments Corporation 1 Introduction to LabVIEW Hands-On

CLAD Sample Exam 04. B. When you create an Array constant on the Block Diagram, it is not visible on the Front Panel.

LabVIEW TM Basics I Introduction Course Manual

Open Excel by following the directions listed below: Click on Start, select Programs, and the click on Microsoft Excel.

Basic Data Acquisition with LabVIEW

INTRODUCTION TO LABVIEW

1

National Instruments Corporation 1 Introduction to LabVIEW Hands-On

LabVIEW Upgrade Notes

LabVIEW Real-Time Module for Mac OS X User Manual Addendum

Exercise 1. Section 2. Working in Capture

Experiment 1: Introduction to Labview 8.0 (tbc 1/7/2007, 1/13/2009,1/13/2011)

ni.com Preparing for the CLAD Exam

Transcription:

Goal Description Use a While Loop and an iteration terminal and pass data through a tunnel. Create a VI that continuously generates random numbers between 0 and 1000 until it generates a number that matches a number selected by the user. Determine how many random numbers the VI generated before the matching number. Design Table 1. Inputs and Outputs Type Name Properties Input Number to Match Double-precision, floating-point between 0 and 1000, coerce to nearest whole number, default value = 50 Output Current Number Double-precision, floating-point Output # of Iterations Integer

Figure 1. Auto Match Flowchart Implementation The files that you need to complete this exercise are here: <NI elearning>\lv Core 1\While Loops Repeating the Code\Exercise. Build the following front panel and modify the controls and indicators as shown on the front panel in Figure 2 and described in the following steps. Figure 2. Front Panel LabVIEW Core 1 2 ni.com

1. Open a blank VI. 2. Save the VI as Auto Match.vi in the <Exercise> directory. 3. Create the Number to Match input. Add a numeric control to the front panel window. Label the control Number to Match. 4. Set the default value for the Number to Match control. Set the Number to Match control to 50. Right-click the Number to Match control and select Data Operations»Make Current Value Default. 5. Set the properties for the Number to Match control so that the data range is from 0 to 1000, the increment value is 1, and the digits of precision is 0. Right-click the Number to Match control and select Data Entry from the shortcut menu. The Data Entry page of the Numeric Properties dialog box appears. Disable the Use Default Limits checkbox. Set the Minimum value to 0 and select Coerce from the Response to value outside limits pull-down menu. Set the Maximum value to 1000 and select Coerce from the Response to value outside limits pull-down menu. Set the Increment value to 1 and select Coerce to Nearest from the Response to value outside limits pull-down menu. Select the Display Format tab. Select Floating Point and change the Precision Type from Significant digits to Digits of precision. Enter 0 in the Digits text box and click the OK button. 6. Create the Current Number output. Add a numeric indicator to the front panel window. Label the indicator Current Number. National Instruments Corporation 3 LabVIEW Core 1

7. Set the digits of precision for the Current Number output to 0. Right-click the Current Number indicator and select Display Format from the shortcut menu. The Display Format page of the Numeric Properties dialog box appears. Select Floating Point and change the Precision Type to Digits of precision. Enter 0 in the Digits text box and click the OK button. 8. Create the # of iterations output. Place a numeric indicator on the front panel. Label the indicator # of iterations. 9. Set the representation for the # of iterations output to a long integer. Right-click the # of iterations indicator. Select Representation»I32 from the shortcut menu. Create the following block diagram. Refer to the following steps for instructions. Figure 3. Block Diagram 10. Generate a random number integer between 0 and 1000. Add the Random Number (0-1) function to the block diagram. The Random Number (0-1) function generates a random number between 0 and 1. Add the Multiply function to the block diagram. The Multiply function multiples the random number the y input to produce a random number between 0 and y. LabVIEW Core 1 4 ni.com

Wire the output of the Random Number function to the x input of the Multiply function. Right-click the y input of the Multiply function, select Create» Constant from the shortcut menu, enter 1000, and press the <Enter> key to create a numeric constant. Add the Round to Nearest function to the block diagram. This function rounds the random number to the nearest integer. Wire the output of the Multiply function to the input of the Round To Nearest function. Wire the output of the Round To Nearest function to the Current Number indicator. 11. Compare the randomly generated number to the value in the Number to Match control. Add the Not Equal? function to the block diagram. This function compares the random number with the Number to Match and returns True if the numbers are not equal; otherwise, it returns False. Wire the output of the Round To Nearest function to the x input of the Not Equal? function. 12. Repeat the algorithm until the Not Equal? function returns False. Add a While Loop from the Structures palette to the block diagram. Right-click the conditional terminal and select Continue if True from the shortcut menu. Wire the Number to Match numeric control to the border of the While Loop. An orange tunnel appears on the While Loop border. Wire the orange tunnel to the y input of the Not Equal? function. Wire the output of the Not Equal? function to the conditional terminal. 13. Display the number of random numbers generated to the user by adding one to the iteration terminal value. Wire the iteration terminal to the border of the While Loop. A blue tunnel appears on the While Loop border. National Instruments Corporation 5 LabVIEW Core 1

Tip Each time the loop executes, the iteration terminal increments by one. You must wire the iteration value to the Increment function because the iteration count starts at 0. The iteration count passes out of the loop upon completion. Add the Increment function to the block diagram. This function adds 1 to the While Loop count. Wire the blue tunnel to the Increment function. Wire the Increment function to the # of iterations indicator. 14. Save the VI. Test 1. Display the front panel. 2. Change the number in Number to Match to a number that is in the data range, which is 0 to 1000 with an increment of 1. 3. Right-click the Current Number indicator and select Advanced» Synchronous Display. Note If synchronous display is enabled, then every time the block diagram sends a value to the Current Number indicator, the block diagram will stop executing until the front panel has updated the value of the indicator. In this exercise, you enable the synchronous display, so you can see the Current Number indicator get updated repeatedly on the front panel. Typically, the synchronous display is disabled to increase execution speed since you usually do not need to see every single updated value of an indicator on the front panel. 4. Run the VI. 5. Change the Number to Match and run the VI again. Current Number updates at ever iteration of the loop because it is inside the loop. # of iterations updates upon completion because it is outside the loop. 6. To see how the VI updates the indicators, enable execution highlighting. On the block diagram toolbar, click the Highlight Execution button to enable execution highlighting. Execution highlighting shows the movement of data on the block diagram from one node to another so you can see each number as the VI generates it. 7. Run the VI and observe the data flow. LabVIEW Core 1 6 ni.com

8. Try to match a number that is outside the data range. Change Number to Match to a number that is out of the data range. Run the VI. LabVIEW coerces the out-of-range value to the nearest value in the specified data range. 9. Close the VI. End of Exercise National Instruments Corporation 7 LabVIEW Core 1

Notes LabVIEW Core 1 8 ni.com