E N D
1. LabVIEWgetting started By Amaury Rolin
2. Front Panel User Interface
This is where controls and indicators go
3. Controls Pallet Right click on front panel to get the controls pallet.
Use it to place controls and indicators
4. Controls and Indicators
5. Block Diagram Your logic goes here.
Controls and indicators have terminals on the block diagram
6. Mine looks like this
7. Set your options Tools>>options>>Place front panel teminals as icons uncheck to get the small terminals
8. To change one that’s already like that Right click on the terminal.
Learn to love the right click.
9. Cursor Changes Depending on Context Near the edge of a terminal you will get a wire spool
Click on the terminal when you have a spool and you can drag the wire to an other terminal.
10. My first program You have created a program that takes the value in control and sends it to indicator
Run it by clicking the white arrow on the upper left
Put a value in the control and run it aggain
Run it repeatedly by pressing the loopy run arrows
11. Dataflow LabVIEW is a Dataflow programing language (as opposed to object oriented or functional)
Data flows along wires from inputs to outputs
12. Hover Help Ctrl+h while you are over a part of your code.
It’s your friend!
13. A Slightly More interesting Program -Add A and B Right click on the wire and insert the Add function form the Numeric pallet
Note the broken run arrow the VI will not run because not all of the inputs of the add are connected
Try pressing the run arrow and see
14. A Slightly More interesting Program -Add A and B With your cursor over the bottom terminal of the add, right click>>Create>>Control
Note that when your mouse got over the terminal it turned into a wire tool and the cursor blinked.
Learn to pick up on these cues!
Learn to love the right click!
Note that the Lable of the new control is black – this is a cue…you can edit it’s name
Note that LabVIEW is typically really clever about making a control of the type you want when you create it from the block diagram like this.
15. While Loops Right click on the block diagram to get the functions pallet select the while loop
Drag the marquee around the code you want to loop over
Right click on the Loop Condition and create a control
LabVIEW will inteligently default this control to a boolean button named stop
Run this using the run arrow. Notice that the run arrow stays black until you this the stop button and then answer to Control + y keeps making its way into the indicator
16. Parts of the while loop The Loop Iteration Terminal lets you know how many times the loop has run so far.
The first value of i is 0
You can use this value by wiring to it like a control
The Loop Condition controls when the loop stops.
This loop will keep running until the loop condition is true
In the previous case the stop button is true when you push it
In other examples we will stop when we find something to be true
17. For Loops I encourage you to learn how for loops work on your own and explore the really neat feature of autoindexing.
Ask me about it if you want
The NXT will not do for loops or autoindexing
so I won’t show it.
18. Use Highlight Execution to Debug Turn the Highligh Execution light on and watch your data flow along the wires you can get a good idea of how data flows like this.
19. Making DecisionsLets take the square root of something only if it is positive Find the comparator you want in the comparison palette
on an empty part of the diagram Right click>> Comparison>> Greater Than 0
Wire your control to the comparator
20. Place a case strcture
22. Data Types
23. Data Types controls
24. Changing the Numeric to an integer on the terminal or constant Right Click>> Represntation
25. Integer types
26. Case Structures Revisited Not only true or false!
Connect other data types and it adapts!
this is called polymorphic and many things in LabVIEW act this way
You can use a string, a number, or boolean
If the input is not boolean you must declare a default case
In windows a case can handle multiple conditions
1,10 -> 1 or 10
1..10 -> 1 or 2 or 3 … or 10
The NXT can only support one condition per case
27. Parts of the Case Structure The ? Selector is the input to the case structure. It’s value will trigger one of the frames to execute.
The Selector Label indicates the condition that must be matched to run the code in that frame.
Default indicates that this frame will run if no other condition was met
Use the Selector Label to pick which case you are editting
Right click on the edge of the case structure to bring up many options
28. More on data flow Stops the motor when light sensor is greater than 25 or loop has run 102 times
29. Sequence Structure
30. Arrays Collections of a specific datatype.
31. Use your cues Pay close attention to where your mouse is relative to the parts of the array.
There are nested edges that do different things.
The datatype resizes to show you more details on your data
The array resizes to show you more of your data at once
The index resizes to change between a 1D 2D and nD array
Resizing the array container does not resize the amount of elements in the array.
32. More array details
33. Some Array Functions
34. Remove Even Numbers From a List
35. Shift Registers
36. What would remove even numbers do if we forgot the shift register?
37. Clusters Group data together
Bundle and UnBundle (By Name does not work on NXT)
Create them like you do an array (drop a shell drop things in them)
39. Unbundle is obvious Use unbundle and wire out the info you need
Hover over a terminal to find out what its name is
Note the [] braces on the lower terminal this cluster has arrays in it!
40. Bundle is almost as obvious Wire the data that you want to bundle together into the bundle!
Bundle has an additional input that tells it the type of what you are bundling together
If there is already data in your cluster any values that are not wired up will persist.
In this case only the Num Checkpoints field will be updated in the RNDF cluster
41. Random Hint You can’t have 2D arrays in the NXT and in general you can’t have 2D arrays that are not rectangular (some rows or cols longer than others)
You can get around both of these problems by making an array of clusters with arrays!
42. When is this useful?How about representing an RNDF?
43. Typedefs Do yourself a favor when you create a cluster.
Go to a control for that cluster, Right Click>> Advanced>> Customize.
In the new window set the type to typdef and save the file.
Go ahead and give the components names at this time it will be handy. If the lables are not visible right click>>Visible Items>>Label
In the future when you need to change the control go back to the Customize option.
44. To place a typdef control or constant
45. You now know 80% of the basics That’s my guess
Pat yourself on the back!
Now lets take a quick look at the NXT stuff.