Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 44

3.

2 Edit and Debug


• Creating a VI
• Editing Techniques
• Debugging Techniques

1
Creating a VI
• create front panel
• edit control and indicator
• block diagram
• control and indicator terminal
• nodes
• connect wires
• wires types
• data flow programming

2
Creating a VI
Front Panel Window

Block Diagram Window

Control Indicator
Terminals Terminals

3
Creating a VI – Block Diagram
• After creating front panel controls and
indicators, switch to Block Diagram <Ctrl-E>
[LabVIEW help → Search → Keyboard Shortcuts]
• Move Front Panel objects to desired locations
• Place functions on diagram
• Wire appropriate terminals together to
complete the diagram

4
control and indicator terminal

5
nodes

6
connect wires

7
wiring tips
Wiring “Hot Spot” Click To Select Wires

Spacebar Flips Wire Orientation Click While Wiring To Tack Wires Down

8
wires types
Scalar 1D Array 2D Array

Numeric Orange (floating point)


Blue ( integer)

Boolean Green

String Purple

9
data flow programming
• Block diagram does NOT execute left to right
• Node executes when data is available to ALL
input terminals
• Nodes supply data to all output terminals when
done

10
Tut 3.2.1 - Convert °C to °F
Students build Convert C to F.vi
This exercise is to create a VI that takes a
number representing Celsius (C) degrees and
converts it to a number representing
Fahrenheit (F) degrees.
N.B. F = C x (9 / 5) + 32
* * This VI will be used in a later exercise * *
Time to complete: 30 min.

11
Tut 3.2.1 - Convert °C to °F

12
Tut 3.2.1 - Convert °C to °F

13
Editing Techniques
• Wiring Tool
• Auto Create I/O
• Delete Objects
• Undo Edit
• Duplicate Objects
• Label Objects
• Remove Broken Wire
• Change Font
• Align Objects
• Distribute Objects
• Copy Objects
• Color Objects
14
Wiring Tool

15
Auto Create I/O

16
Delete Objects

17
Undo Edit

18
Duplicate Objects

19
Label Objects

20
Remove Broken Wire

21
Change Font

22
Align Objects

23
Distribute Objects

24
Copy Objects

25
Color Objects

26
Tut 3.2.2: Editing Techniques
Students modify Editing Exercise.vi
Time to complete: 30 min.

In this exercise, we’ll modify the sample VI named


Editing Exercise.vi using the editing techniques from
this lesson.

Let’s begin by editing objects on the front panel using


the positioning, coloring, and labeling tools.

27
Tut 3.2.2: Editing Techniques

28
Tut 3.2.2: Editing Techniques

29
Debugging Techniques
• Broken Run Button
• Execution Highlighting
• Single Step
• Probes
• Breakpoints

30
Debugging Techniques
• Finding Errors
Click on broken Run button
Window showing error appears
• Execution Highlighting
Click on Execution Highlighting button; data
flow is animated using bubbles. Values are
displayed on wires.
• Probe
Right-click on wire to display probe and it
shows data as it flows through wire segment

You can also select Probe tool from Tools


palette and click on wire

31
Debugging Techniques
• Breakpoints
Select Breakpoint tool from Tools palette and click
on wire or node where you want execution to pause

• Step Into, Over, and Out buttons for Single


Stepping
Click on Step Into button to enable single stepping
Once Single Stepping has begun, the button steps
into nodes

Click on Step Over button to enable single stepping


or to step over nodes

Click on Step Out button to step out of nodes

32
Broken Run Button

33
Execution Highlighting

34
Single Step

35
Probes

36
Breakpoints

37
Tut 3.2.3 : Debug Exercise
• This exercise uses debugging tools to correct a
broken VI and to view data as it passes through
the VI.
• Students modify and run Debug Exercise
(Main).vi
• Uses Debug Exercise (Sub).vi
• Time to complete: 30 min.

38
Tut 3.2.3 : block diagram

39
Tut 3.2.3 : error list

40
Tut 3.2.3 : single step

41
Tut 3.2.3 : probe

42
Tut 3.2.3 : break point

43
Lab 2 - LabVIEW Revision Exercise 1

44

You might also like