CS 320 n Visual Programming More Lab VIEW

CS 320 n –Visual Programming More Lab. VIEW Foundations Visual Programming Lab. VIEW Foundations

What We Will Do Today • Look at some more features of Lab. VIEW • Work on exercises involving debugging and creating sub VIs Visual Programming Lab. VIEW Foundations 2

VI Libraries • VIs can be saved as individual programs • A group of VIs can be saved together as a VI library • creating -> an option in the save window • opening -> open as regular file, then select which VI to open from library Visual Programming Lab. VIEW Foundations 3

From Last Time • Some functions have a variable number of inputs • The string concatenation function • When opened notice blue dots on top and bottom • function can be expanded for more inputs – note visual cue on order of inputs in result for three input function Visual Programming Lab. VIEW Foundations 4

Debugging • VIs that are broken cannot be run – analogous to syntax error in text based programming languages • Most common mistakes – required input missing on function terminals (for example, add) – type mismatch on data (wire double when integer was expected – loose, unconnected wires – sub VI is broken – multiple inputs into a single indicator Visual Programming Lab. VIEW Foundations 5

Broken Programs • Clicking on the broken arrow brings up a list of errors • Clicking on an error displays more information about the error Visual Programming Lab. VIEW Foundations 6

Stepping Through a Program • Sometimes you want to observe a program step by step, not all at once • Click on the single set button instead of the run button • Press the single step button to see the flow of the program Visual Programming Lab. VIEW Foundations 7

Execution Highlighting • Another excellent debugging tool is Execution Highlighting – aside: why no debugging tools in Alice? • Select “Highlight Execution” and data values and movement shown as program runs. Very useful • Can be used as program runs or combined with stepping through program Visual Programming Lab. VIEW Foundations 8

Probes • To view the value on a wire or result of a function you can either set up an indicator or use a probe • With a running program, probe is auto selected when putting the cursor near a wire • When the program is not running probes can be added. – – choose the “Window” menu select “Show Tools Palette” click on the probe tool to add probes be sure to change Tool back to auto select when finished Visual Programming Lab. VIEW Foundations probe 9

Breakpoints • Suppose you want to stop the program at a single point, deep into the execution • using the step by step control is a pain • set a breakpoint – right click or use breakpoint tool – program will run normally until it hits that point Visual Programming Lab. VIEW Foundations break point on wire and function 10

Creating sub VIs • If you create a program and want to use that in other program you can create a Sub VIs • steps in creating a sub VI – assign VI controls and indicators to wire terminals on its connector pane so that data can be passed into and out of the VI – create an icon for the VI Visual Programming Lab. VIEW Foundations 11

C to F • Create icon – right click on icon in upper right corner and select “Edit Icon” Visual Programming Lab. VIEW Foundations 12

Assign Connectors • Defining parameters – like in Alice • Right click icon on the front panel. (Not the block diagram. ) • Select “Show Connector” – two terminals – input / control on left – output / indicator on right • click in left hand terminal / box on icon and select front panel control to set • repeat for right hand side terminal Visual Programming Lab. VIEW Foundations 13
- Slides: 13