You are on page 1of 15

Start LabVIEW menu bar/Help/Find Examples => Industry Applications/Analysis/Temperature System Demo.vi or Files/Open ../examples/apps/tempsys.llb/Temperature System Demo.

vi

1
Monday, November 1, 2010 1

The menu bar/View/Tools Palette The Front Panel, upper left, Run arrow. Press the Run arrow and observe Front Panel

2
Monday, November 1, 2010 2

Black arrow shows program is running. Abort button is activated, in case you wish to stop program.

Current Temperature appears to be coming from an random number generator. A good guess is that it comes from this icon.

3
Monday, November 1, 2010 3

Move your cursor across the Front Panel window. Observe the shape of the cursor and the Context Help window. There are at least four different cursor shapes.

Task: Find 4 cursor shapes. Task: Use text cursor to set Low Limit to 74.05 Task: Use nger cursor to set High Limit to roughly 84 Task: Change the Update Period with clicks. Read the context help window.

4
Monday, November 1, 2010 4

Task: Set the Tools Palette to Automatic Tool Selection by clicking the rectangle in the upper right corner of the Tool Palette window. Move your cursor across the Block Diagram window. Observe the shape of the cursor and the Context Help window. There are at least ve different cursor shapes.

Lets look at these icons.


5
Monday, November 1, 2010 5

Task: What is this thing that looks like a musicians metronome? Task: What is the thing that looks like a triangle with an X? Task: Why a blue line and a green line? Task: Select DBL/Update Period and with control key pressed, select Find Control

6
Monday, November 1, 2010 6

Task: Double-click on the icon with a thermometer/waveform output. Then, cntrl-E (or cmd-E). Task: Click on the column of numbers and try extending the bottom to show more numbers. Task: Explain the divide-R-IQ icon? Task: Activate Highlight Execution (the light bulb icon) and then press the run arrow. Task: Notice the matching pair of up/down blue triangles. With highlighted execution and multiple runs, try to explain the performance of the up/down triangles? BTW, these are call a shift registers. Note: Shift registers are the rst difcult concept to master in LabVIEW.

7
Monday, November 1, 2010 7

Task: LabVIEW menu bar/Help/Search the LabVIEW Help.. Search keyword = shift register Of the ~70 hits, select For Loops and While Structures Scroll about halfway down the page to get to this text.
Shift Registers and the Feedback Node in Loops
Use shift registers or the Feedback Node with For Loops or While Loops to transfer values from one loop iteration to the next. Shift Registers Use shift registers when you want to pass values from previous iterations through the loop to the next iteration. A shift register appears as a pair of terminals, shown as follows, directly opposite each other on the vertical sides of the loop border.

The terminal on the right side of the loop contains an up arrow and stores data on the completion of an iteration. LabVIEW transfers the data stored in the right terminal of the shift register to the left terminal. The loop then uses the data from the left terminal as the initial values for the next iteration. This process continues until all iterations of the loop execute. After the loop executes, the terminal on the right side of the loop returns the last value stored in the shift register. Create a shift register by right-clicking the left or right border of a loop and selecting Add Shift Register from the shortcut menu. A shift register transfers any data type and automatically changes to the data type of the first object wired to the shift register. The data you wire to the terminals of each shift register must be the same type. You can add more than one shift register to a loop. If you have multiple operations that use previous iteration values within a loop, use multiple shift registers to store the data values from those different processes in the structure, as shown in the following block diagram.

Task: Write the program shown to the left.

In the previous block diagram, the upper right shift register terminal transfers 2, the sum of 0 and 2 in the first iteration, to the upper left terminal as the initial value for the second iteration of the addition operation. The lower right terminal transfers 2, the product of 1 and 2 in the first iteration, to the lower left terminal as the initial value for the second iteration of the multiplication operation. The second iteration adds 2 and 2 and transfers the outcome, 4, to the upper left terminal for the third iteration. The second iteration also multiplies 2 and 4 and transfers the outcome, 8, to the lower left terminal for the third iteration. After ten iterations, the upper right terminal transfers the final outcome of the addition operation to the upper indicator and the lower right terminal transfers the final outcome of the multiplication operation to the lower indicator.

Monday, November 1, 2010

Task: Write the program shown to the left. Step 1: LabVIEW menu bar/File/New VI Step 2: Display block digram with cntrl-E (cmd-E) Step 3: LabVIEW menu bar/View/Functions Palette Step 4: Drill down Programming/Structures to the For loop icon, and drag this icon into the block diagram window.

9
Monday, November 1, 2010 9

Step 5: Drill down Programming/Numeric to the Numeric Constant icon, and drag this icon into the block diagram window.

Step 6: Also from Programming/Numeric, grab icons for Add and for Multiply. Step 7: Use option-drag methods to make some more Numeric constant icons and drag around. The lines (wires) are not yet important.
10
Monday, November 1, 2010 10

Step 8: Cntrl-E to the Front Panel and add Numeric Indicator. Option-drag to make two of these on the Front Panel. Label each icon as you wish and drag to position as you wish. Note: The Functions & Controls Palette interchange as you switch (cntrl-E) from Front Panel to Block Diagram. Note: The cursor (Front Panel) changes from positioning to value to text as needed. Step 9: Cntrl-E to the Block Diagram and arrange icons to something like this (ignoring lines or wires).

11
Monday, November 1, 2010 11

Step 10: Cntrl-E to the Block Diagram and arrange icons to something like this (ignoring lines or wires). Step 11: Put a cursor on either the left or right edge of the For, press cntrl-mouse button to bring up a menu, and select Add Shift Register. Repeat. Use cursor to slide shift registers up-down into an attractive position.

Step 13: With the wiring tool, start wiring your program. For wiring hints, see the LabVIEW help le.

12
Monday, November 1, 2010 12

Wiring hints (good luck nding this page)

13
Monday, November 1, 2010 13

Step 14: Debugging. You might be wondering where the negative number came from. Lets focus on the color of the wire and its meaning. The context help for blue says 32-bit integer with range from -2,147,483,648 to 2,147,483,647 (or -2^31 up to (2^31 - 1). Perhaps our number is really big. Lets enter 1.0 into the numerical constant.

Success: Success. The 1.0 forces the wire to be double-precision real (which can handle big numbers, and now we have a positive result on the front panel. Question: What are the shift registers doing? Run program with debugger on.

14
Monday, November 1, 2010 14

Question: What are the shift registers doing? Run program with debugger on.

15
Monday, November 1, 2010 15

You might also like