Wright State University
LABVIEW HANDOUT 2CHAPTER 2: THE FOR LOOP AND THE WAVEFORM GRAPHOpen a Blank VI. Place a For Loop on the Block Diagram:Functions Palette>>Programming >>Structures>>For LoopThe initial value of the Loop Iteration Terminal is zero, and increments by one integer each iteration. The Loop Count Terminal resides in the upper left-hand corner. The loop terminates when i = N ? 1. Place a Waveform Graph on the Front Panel: View>>Controls Palette>>Modern>>Graph>>Waveform GraphChange the x-axis label to x (radians) and the y-axis label to sin(x). On the Block Diagram, move the Waveform Graph outside of the For Loop. Place a Sine Function icon in the For Loop. Wire the Loop Iteration Terminal to the input of the Sine Function. Eliminate the red Coercion Dot on the Sine Function input. Divide the Loop Iteration output (Sine Function input) by 5. Create a constant for the input of the Loop Count Terminal equal to 100. Wire the output of the Sine Function to the Waveform Graph. Notice that the output wire of the For Loop is thick and orange, denoting a one-dimensional array of double precision floating point numbers. A small box on the edge of the For Loop is called the Auto-Indexed Tunnel. This accumulates the array of values. When the For Loop completes its last iteration, it sends the array of numbers to the Waveform Graph. Run the program. Insert a Bundle Function on the wire that connects the For Loop and the Waveform Graph:Right-Click>>Insert>>All Palettes>>Programming>>Cluster, Class, & Variant>>BundleBroken wires can be deleted by typing CTRL-B. Resize the Bundle to have three inputs by pulling down on its lower edge. Copy the constant 5 box by left-click highlighting the constant and then typing CTRL-C. Place the cursor close to the Bundle and left-click. Then paste the constant using CTRL-V. Wire constants to the top and middle inputs with values 0 and 0.2, respectively. Wire the output of the For Loop to the bottom input of the Bundle. Wire the output of the Bundle to the Waveform Graph. Notice the color of the output wire of the bundle has changed to pink. Use Show Context Help to determine the meaning of the color and the inputs for the Waveform Graph. Run the program. Change the For Loop to a While Loop: Right-Click>>Replace with While LoopInsert a logical comparison function on the Block Diagram:Functions Palette>>Programming>>Comparison>>Equal?Bring the constant (100) into the While Loop and compare it to the Loop Iteration Terminal using the Equal? Function. Wire the output of the Equal? Function to the Loop Condition Terminal. This will stop the While Loop after 101 iterations. Place an Array Indicator on the output wire of the While Loop:Right-Click>>Create>>Indicator Rerun the program. Resize the Array Indicator and examine the contents. Place probes on several wires using the Probe Data Function: View>>Tools Palette>>Probe DataRerun the program and observe the data. Delete the probes. On the Tools Palette, click on Automatic Tool Selection. Change the constant 100 to 5. Press the Highlight Execution button on the Block Diagram. Rerun the program. Notice how the array of Sine Function data is stored at the Auto-Indexed Tunnel at the edge of the While Loop until the iterations are complete. Clean up the appearance of the Block Diagram and make it as compact as possible. Place your name on the Front Panel. Print out the program using Microsoft Word by taking a screen shot of the Front Panel and Block Diagram. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- illinois state university online courses
- illinois state university programs
- illinois state university bachelor degrees
- illinois state university degree programs
- illinois state university online degree
- illinois state university online masters
- illinois state university summer schedule
- illinois state university summer classes
- illinois state university phd programs
- illinois state university online program
- illinois state university online degrees
- illinois state university masters programs