{"id":19585,"date":"2017-03-23T10:00:32","date_gmt":"2017-03-23T17:00:32","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=19585"},"modified":"2021-06-11T10:38:01","modified_gmt":"2021-06-11T17:38:01","slug":"labview-debugging-techniques","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/labview-debugging-techniques\/","title":{"rendered":"LabVIEW Debugging Techniques"},"content":{"rendered":"<p>Anyone who has spent a lot of time using <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a> knows how important good debugging habits are. Every LabVIEW programmer has their own personal toolbox of debugging tricks. Some of these are common, like Probes and Breakpoints, while others are probably personal things created or figured out on their own. In this post, I will go over some of the techniques I use the most often in the hope that one of them might save you some trouble the next time your code doesn\u2019t do what you intended.<\/p>\n<h3>Probe Tool<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-19703 size-medium aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/03\/maxresdefault-3-e1490208986578-600x334.jpg\" alt=\"\" width=\"600\" height=\"334\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/03\/maxresdefault-3-e1490208986578-600x334.jpg 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/03\/maxresdefault-3-e1490208986578-768x428.jpg 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/03\/maxresdefault-3-e1490208986578-1024x570.jpg 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/03\/maxresdefault-3-e1490208986578.jpg 1280w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Probes are the first and simplest tools for <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a> debugging, but they\u2019re deceptively powerful. With almost no extra effort, you can move beyond simply hanging a probe on a wire and increase the amount of information available as you track down problems.\u00a0If data is available, the probe immediately updates and displays the data in the\u00a0Probe Watch Window\u00a0during execution highlighting. When execution pauses at a node because of single-stepping or a breakpoint, you also can probe the wire that just executed to see the value that flowed through that wire.<\/p>\n<h3>Retain Wire Values<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium aligncenter\" src=\"http:\/\/www.ni.com\/cms\/images\/devzone\/pub\/clip_image003.png\" width=\"394\" height=\"127\" \/><\/p>\n<p>Retain Wire Values is an often-overlooked feature of the <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a> development environment. When you enable Retain Wire Values for a VI, LabVIEW automatically stores the last value of every wire on the VI\u2019s block diagram. Then, you can hover over any wire, and the probe tool will display a tooltip of that wire\u2019s last value, even if the VI is no longer running.<\/p>\n<h3>Create Custom Probes<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-19705 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/03\/clip_image005.png\" alt=\"\" width=\"302\" height=\"350\" \/><\/p>\n<p>You can use<a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\"> LabVIEW<\/a> Custom Probes to create powerful and complex debugging tools, but you can also use them without writing any code at all. For example, you can make an easy \u201chistory probe\u201d that displays the previous values of any numeric wire using\u00a0Custom Probe &gt;&gt; Controls &gt;&gt; Waveform Chart. This can help you uncover patterns or trends in data you\u2019re probing without writing special probe code yourself.<\/p>\n<h3>Execution Tracing<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-19054 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/02\/Screen-Shot-2017-02-06-at-11.21.30-AM.png\" alt=\"\" width=\"569\" height=\"480\" \/><\/p>\n<p>When all else fails, sometimes all you can do is trace your code step by step. When you\u2019re faced with this kind of problem, there are several ways to trace execution in <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a>.\u00a0The most obvious is the built-in Execution Highlighting in LabVIEW, otherwise known as \u201cthe light bulb.\u201d If Probes are the first tool of LabVIEW debugging, the light bulb is the second.<\/p>\n<p><a href=\"https:\/\/www.labviewmakerhub.com\/doku.php?id=learn:tutorials:labview:basics:debugging\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-19706 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/03\/07-Debugging.png-600x450.jpeg\" alt=\"\" width=\"600\" height=\"450\" \/><\/a><\/p>\n<p>Thank you for reading my blog post, and for more LabVIEW debugging tips and tricks follow this\u00a0<a href=\"http:\/\/www.ni.com\/newsletter\/51473\/en\/\">link<\/a>. Or if you would rather watch a video, follow this <a href=\"https:\/\/www.labviewmakerhub.com\/doku.php?id=learn:tutorials:labview:basics:debugging\">link<\/a> to watch Sam Kristoff walk through some basic debugging methods. If you are interested in trying out LabVIEW for yourself, you can purchase a copy of\u00a0<a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW 2014 Home Edition<\/a>\u00a0which includes everything you will need to run\u00a0<a href=\"https:\/\/www.labviewmakerhub.com\/doku.php?id=learn:tutorials:libraries:linx:3-0:beaglebone-black-setup\">LINX 3.0<\/a>.\u00a0Please comment below with any questions or comments you may have.<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-19585 jlk' data-task='like' data-post_id='19585' data-nonce='ee750c7abc' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-19585 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-19585 jlk' data-task='unlike' data-post_id='19585' data-nonce='ee750c7abc' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-19585 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-19585 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Austin walks through the essentials of LabVIEW debugging!<\/p>\n","protected":false},"author":42,"featured_media":19706,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4325,4323,1563],"tags":[],"ppma_author":[4493],"class_list":["post-19585","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debug-validation-test","category-software","category-guide"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/03\/07-Debugging.png-e1490224585145.jpeg","authors":[{"term_id":4493,"user_id":42,"is_guest":0,"slug":"astanton","display_name":"Austin Stanton","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/056fddaefc60a1f99c226ea5757a8c41?s=96&d=mm&r=g","author_category":"","user_url":"","last_name":"Stanton","last_name_2":"","first_name":"Austin","first_name_2":"","job_title":"","description":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/19585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=19585"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/19585\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/19706"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=19585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=19585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=19585"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=19585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}