Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of...
Transcript of Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of...
![Page 1: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/1.jpg)
Debugging in LabVIEW
Hans-Pe3er Halvorsen
![Page 2: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/2.jpg)
What is “Debugging”?
Debugging is the process of locating and fixing or bugs (errors) in your computer program code, in this case your LabVIEW program
![Page 3: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/3.jpg)
Debugging in LabVIEWLabVIEW has powerful features for Debugging your Code, such as:• Broken Run Arrow• Highlight Execution• Probes• Breakpoints
![Page 4: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/4.jpg)
Broken Run Arrow• Click the broken Run button to display the
Error list window, which lists all the errors. • Double-click an error description to display
the relevant block diagram or front panel and highlight the object that contains the error.
![Page 5: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/5.jpg)
Broken Run Arrow - Example
Double-click
![Page 6: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/6.jpg)
![Page 7: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/7.jpg)
Highlight Execution• View an animation of the execution of the block
diagram by clicking the Highlight Execution button.
• Execution highlighting shows the flow of data on the block diagram from one node to another using bubbles that move along the wires.
• Note! Execution highlighting greatly reduces the speed at which the VI runs.
![Page 8: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/8.jpg)
Highlight Execution
![Page 9: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/9.jpg)
![Page 10: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/10.jpg)
Probes• Use the Probe tool to check intermediate
values on a wire as a VI runs.
• Probe Watch Window
![Page 11: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/11.jpg)
Probes
![Page 12: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/12.jpg)
Probe Watch Window
![Page 13: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/13.jpg)
![Page 14: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/14.jpg)
Breakpoints• Use the Breakpoint tool to place a breakpoint
on a VI, node, or wire on the block diagram and pause execution at that location.
• When you set a breakpoint on a wire, execution pauses after data pass through the wire.
![Page 15: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/15.jpg)
BreakpointsSet/Clear Breakpoint
Tools Palette:
Breakpoint Toolbar
![Page 16: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/16.jpg)
Breakpoint Manager
Enable/DisableBreakpoints
![Page 17: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/17.jpg)
![Page 18: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/18.jpg)
How To Avoid Bugs• Structure your Code properly, i.e., avoid socalled
«Spaghetti Code»• Flow from left to right• Use SubVIs• Use the State Machine Programming teqnique• Make it simple• Keep in mind that others should understand your
Program• ..
![Page 19: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/19.jpg)
Bad vs. Good Code
Use SubVIs!!!
Avoid Spaghetti Code!
The Flow should go from left to right
Make your code readable for others!
Use Labels and Comment your Code
This is a comment
![Page 20: Debugging in LabVIEW · 2019-01-16 · Highlight Execution •View an animation of the execution of the block diagram by clicking the Highlight Execution button. •Execution highlighting](https://reader031.fdocuments.us/reader031/viewer/2022041916/5e69a1028bdd936cd0711ed0/html5/thumbnails/20.jpg)
Hans-Petter Halvorsen
University of South-Eastern Norwaywww.usn.no
E-mail: [email protected]: https://www.halvorsen.blog