lesson 2 bme 405 fall 2010 loops graphs arrays with activities (1)

Lesson 2 bme 405 fall 2010 loops graphs arrays with activities (1)

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Lesson 2: Loops Graphs Arrays in LabVIEW 2 Plan While Loop and for loop Shift registers Single or multiplots charts Arrays Matrices Graphs 3 Loops, shift registers, feedback nodes 4 Loops Two types of loops similar to Repeat-until loop and Do loop in text-based programming languages While loop: repeat code in subdiagram until a condition is met For loop: repeat code in subdiagram a preselected number of times 5 While loop While loop and For loop found in structures palette While loop executes always once because it checks the conditional terminal at the end of the iteration Boolean controls are false by default when first added to control panel. Stop boolean control lets loop run until it is switched to true (as long as loop is stop if true = default) Conditional terminal: loop executes until terminal receives a true or a false Iteration terminal: counts the number of times the loop has executed. Starts at 0 6 Using the While loop Place loop on block diagram by selecting it from the Structures subpalette of the Functions palette: mouse cursor becomes a miniature of the structure used to enclose the section of code you want to repeat Click mouse button to define the top-left corner, extend, then click the mouse button again at the bottom-right corner. While Loop boundary is created around selected code Drag or drop additional nodes in While Loop if needed. 7 Activity 1: while loop (15 min) 8 For loop For loop execute a predetermined number of times. Also located in the structures subpalette For loop does not execute when count terminal is 0 Count and iteration terminals are long integers with maximum value 2 31-1. Numbers outside of this range wired to count terminal are coerced to within the range Right click on border of for loop and select Remove for loop to remove only the structure and keep its content (works also for while loop) Iteration terminal Count terminal: number of times the loop executes 9 Coercion dots Coercion dots appear when terminals of different types are wired together LabVIEW coerces the real number to integer at run time Coercion dot to alert you when coercion is enforced by LabVIEW You should avoid data coercion whenever possible, (here, change the constant to type Integer), because LabVIEW creates a copy of the data with the coerced type every time you see a coercion dot (memory issue) A coercion dot may be a sign that the wrong data is being passed to function or a subprogram 10...
View Full Document

Page1 / 49

Lesson 2 bme 405 fall 2010 loops graphs arrays with activities (1)

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online