<< Chapter < Page Chapter >> Page >

A For Loop executes a subdiagram a set number of times. shows a For Loop in LabVIEW, a flow chart equivalent of the For Loop functionality, and a pseudo code example of the functionality of the For Loop .

The For Loop is located on the Functions>>All Functions>>Structures palette. You also can place a While Loop on the block diagram, right-click the border of the While Loop , and select Replace with For Loop from the shortcut menu to change a While Loop to a For Loop . The value in the count terminal (an input terminal), shown in , indicates how many times to repeat the subdiagram.

The iteration terminal (an output terminal), shown in , contains the number of completed iterations. The iteration count always starts at zero. Duringthe first iteration, the iteration terminal returns 0 .

The For Loop differs from the While Loop in that the For Loop executes a set number of times. A While Loop stops executing the subdiagram only if the value at the conditional terminal exists.

The For Loop in generates a random number every second for 100 seconds and displays the random numbers in a numeric indicator.

Wait functions

The Wait Until Next ms Multiple function, shown in , monitors a millisecond counter and waits until the millisecond counter reaches a multiple of theamount you specify. Use this function to synchronize activities. Place this function within a loop to control theloop execution rate.

The Wait (ms) function, shown in , adds the wait time to the code execution time. This can cause a problem if code execution time isvariable.

The Time Delay Express VI, located on the Functions>>Execution Control palette, behaves similar to the Wait (ms) function with the addition of built-in error clusters. Refer to Clusters for more information about error clusters.

Wait functions

LabVIEW can represent numeric data types as signed or unsigned integers (8-bit, 16-bit, or 32-bit), floating-point numericvalues (single-, double-, or extended-precision), or complex numeric values (single-, double-, or extended-precision). Whenyou wire two or more numeric inputs of different representations to a function, the function usually returnsoutput in the larger or wider format. The functions coerce the smaller representations to the widest representation beforeexecution, and LabVIEW places a coercion dot on the terminal where the conversion takes place.

For example, the For Loop count terminal is a 32-bit signed integer. If you wire a double-precision,floating-point numeric to the count terminal, LabVIEW converts the numeric to a 32-bit signed integer. A coercion dot appearson the count terminal of the first For Loop , as shown in .

If you wire two different numeric data types to a numeric function that expects the inputs to be the same data type,LabVIEW converts one of the terminals to the same representation as the other terminal. LabVIEW chooses therepresentation that uses more bits. If the number of bits is the same, LabVIEW chooses unsigned over signed.

In the example in , a 32-bit signed integer (I32) and a double-precision, floating-pointnumeric value (DBL) are wired to the Divide function. The 32-bit signed integer is coerced since it uses fewer bits than the double-precision, floating-point numericvalue.

To change the representation of a numeric object, right-click the object and select Representation from the shortcut menu. Select the data type that best represents the data.ut data types.

When LabVIEW converts double-precision, floating-point numeric values to integers, it rounds to the nearest integer. LabVIEWrounds x.5 to the nearest even integer. For example, LabVIEW rounds 2.5 to 2 and 3.5 to 4 .

Refer to the Data Types section of Introduction to LabVIEW, of thismanual or to the LabVIEW Help for more information about data types.

Questions & Answers

if three forces F1.f2 .f3 act at a point on a Cartesian plane in the daigram .....so if the question says write down the x and y components ..... I really don't understand
Syamthanda Reply
hey , can you please explain oxidation reaction & redox ?
Boitumelo Reply
hey , can you please explain oxidation reaction and redox ?
Boitumelo
for grade 12 or grade 11?
Sibulele
the value of V1 and V2
Tumelo Reply
advantages of electrons in a circuit
Rethabile Reply
we're do you find electromagnetism past papers
Ntombifuthi
what a normal force
Tholulwazi Reply
it is the force or component of the force that the surface exert on an object incontact with it and which acts perpendicular to the surface
Sihle
what is physics?
Petrus Reply
what is the half reaction of Potassium and chlorine
Anna Reply
how to calculate coefficient of static friction
Lisa Reply
how to calculate static friction
Lisa
How to calculate a current
Tumelo
how to calculate the magnitude of horizontal component of the applied force
Mogano
How to calculate force
Monambi
a structure of a thermocouple used to measure inner temperature
Anna Reply
a fixed gas of a mass is held at standard pressure temperature of 15 degrees Celsius .Calculate the temperature of the gas in Celsius if the pressure is changed to 2×10 to the power 4
Amahle Reply
How is energy being used in bonding?
Raymond Reply
what is acceleration
Syamthanda Reply
a rate of change in velocity of an object whith respect to time
Khuthadzo
how can we find the moment of torque of a circular object
Kidist
Acceleration is a rate of change in velocity.
Justice
t =r×f
Khuthadzo
how to calculate tension by substitution
Precious Reply
hi
Shongi
hi
Leago
use fnet method. how many obects are being calculated ?
Khuthadzo
khuthadzo hii
Hulisani
how to calculate acceleration and tension force
Lungile Reply
you use Fnet equals ma , newtoms second law formula
Masego
please help me with vectors in two dimensions
Mulaudzi Reply
how to calculate normal force
Mulaudzi
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Labview graphical programming. OpenStax CNX. Apr 09, 2015 Download for free at https://legacy.cnx.org/content/col11408/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Labview graphical programming' conversation and receive update notifications?

Ask