Smart debugging tips for every LabVIEW developer

Author: Omar Mussa, architects and professional services program manager, NI Alliance Partner JKI

JusTIn Goeres, Program Architect and Product Marketing Manager, NI Alliance Partner JKI

Become a LabVIEW vulnerability fixer

If you use NI LabVIEW software frequently, you may have your own debugging skills and technology toolbox when the software does not work as expected. Some of these techniques and techniques are commonly used, and the rest may be explored by yourself.

Figure 1. A clever debugging method that removes the vulnerability. (photo by Brian Searle)

We talked to JKI's LabVIEW Architects (CLA) and friends in the LabVIEW community to learn some "top secret" techniques for quickly identifying, isolating, and fixing vulnerabilities. We learned the following clever debugging techniques.

Using probe

Probes are the first and simplest tool for LabVIEW debugging, but they are very powerful tools. It's extremely easy to place the probe on the line and keep getting information as you find the problem. Here are a few features of the probe:

Save connection value function

The Save Wire Value feature in the LabVIEW development environment is often overlooked. When you enable the wire value save feature for a VI, LabVIEW automatically stores the last value for each wire on the VI block diagram. Then, hover your cursor over any of the wires, even if the VI is not running, the probe tool will display a prompt to display the last value of the wire.

Figure 2. The Save Wire Value button is next to the Light Bulb icon.

Custom probes without writing any code

With LabVIEW Custom Probes, you can create powerful, complex debugging tools without writing any code. For example, you can create a Historical Probe that displays previous values ​​for any number of wires in Custom Probes >> Controls >> Waveforms. This can help you discover patterns or trends in the data you are exploring without having to write special probe code.

Figure 3. Using a waveform probe to display historical values ​​for simple digital connections.

Get custom probes from the LabVIEW Tools Network

Extend your toolbox with a probe created by someone else. SAPHIR offers a range of free custom LabVIEW probes on the LabVIEW Tools Network. Simply download and install the VI Package Manager (VIPM) Community Edition (also free), search for ViBox, and install the probe in a few clicks.

If you are using LabVIEW 2011, you can also get a ViBox from the LabVIEW Tools Network by clicking Find LabVIEW Add-ons... in the LabVIEW Getting Started window.

Figure 4. Installing the SAPHIR custom probe using VIPM.

Hangs when called

Many LabVIEW program architects don't even know that LabVIEW has this feature. The "suspend on call" feature suspends execution so that you can do any or all of the following:

Feel free to change the control value of the VI before the VI runs.

The VI arbitrarily changes the value of the display when returning to the calling program.

Run the VI repeatedly without returning execution to the calling program.

Skip the VI execution altogether and return to the calling VI.

Figure 5. In the SubVI Node Settings window, select the "Suspend on Call" feature.

For a suspend function on call, NI gives a brief description, see here. However, the best way to become familiar with this feature is to practice it yourself.

Unwired front panel controls and displays

Recommended for the FIRST (Promoting Science and Technology) Robotics Competition Team, a technology that is also useful for professional LabVIEW developers

Ben recommends adding a front panel control or display control to the VI, but it is not connected to the connector. These controls and displays work similarly to the Debug input or output, which you can manually control while testing. This makes it easier to generate accidental or extreme events in your application without the need for extensive support or writing of emulation code.

You can also use these debug controls and displays in your built-in applications, provided the LabVIEW Application Builder includes the VI front panel.

See the introduction on LVMastery.com to learn more about Ben's recommended debug subVI.

Execution tracking

If other methods fail, sometimes all you can do is step through the code. There are several ways to perform an execution trace within LabVIEW when you encounter such problems.

The most obvious way is to use the "highlighting execution" feature built into LabVIEW, also known as the "bulb." If the probe is the primary tool for LabVIEW debugging, the light bulb is ranked second. However, if you encounter complex or time-related vulnerabilities, you can choose other more effective tools.

Figure 6. The execution tracking function has more features than the light bulb.

Track disk or memory

An easy way to initiate execution tracking is to record a wire value in one of the subVIs. You can write a simple VI, log the value to a file, or even create a custom probe to display the historical value of the connection. Usually with such a simple trace you can gather enough information to help you find the cause of the vulnerability.

NI LabVIEW Desktop Execution Trace Toolkit

If you are debugging a large, highly parallel application, the LabVIEW Desktop Execution Trace Toolkit with NI Developer Suite 2011 is the "tool" for LabVIEW code analysis. It provides a variety of information about running applications, including detailed memory allocation and redistribution, event generation, and custom information defined by code. Fabiola De la Cueva, one of the founders of the AusTIn LabVIEW Program Architect Forum, pointed out that the toolkit can be used to debug crashed applications because it runs independently of LabVIEW.

Figure 7. Manual execution tracking is risky (image taken from Oliver Widder)

Professional LabVIEW developers are fortunate because the LabVIEW Desktop Execution Trace Toolkit is included in the NI Developer Suite 2011 at no additional cost.

unit test

Test Driven Development (TDD) is a software engineering technique that helps you create better code from scratch, and it is also an effective tool to help you debug existing code.

In TDD, when you find a vulnerability in your application, the first step in the debugging process is to create a unit test that reproduces the vulnerability and causes the test to fail. Only then will you be able to start trying to fix the problem. If the unit test passes, you have cleared the vulnerability.

Figure 8. Where did you test the code?

This bug fix method takes a bit of time, but it has several advantages over other less precise methods:

Unit tests are traceable to show the full extent of the vulnerability and how you can isolate the vulnerability

You or other developers can easily verify or re-verify your fix at any time without having to remember the details of the activation vulnerability.

Unit tests can be automated with other tests in your project, so if the vulnerability reappears, you can know immediately.

There are two main LabVIEW add-ons for unit testing, and the TDD method can be used with another. Check out JKI's Free VI Tester LabVIEW Add-on Tool or see Eli Kerry's LabVIEW Software Engineering Guide to further understand the LabVIEW Unit Test Framework Toolkit, which is included in the NI Developer Suite.

HDMI Cable

About this item
The 8K HDMI cable features a special A.I.S. (anti-interference shielding) design, with multi-layer metal shielding in the connector and additional sheathing of the copper conductors (see image 4 for reference) – for optimum interference protection
Higher performance: With its premium build quality, the HDMI cable surpasses the High Speed specification, carrying UHD-2 resolutions including 8K@60Hz & 4K@120Hz (up to 9.8ft), HDR, 7.1 surround sound, ARC & even Ethernet data
Unmatched robustness: Unlike others, CableDirect HDMI cables are designed in Germany and undergo stringent functionality tests. They feature gold-plated, break-proof plugs and pure copper for interference-free enjoyment and unparalleled longevity
No risk: 36-month manufacturer`s warranty
Wide compatibility: Perfect for PCs/laptops, video game consoles like the PS5 and Xbox, Blu-ray/DVD players, TV and streaming receivers, monitors/screens, TVs, projectors & any other equipment with an HDMI port

Any device with an HDMI port, including: TVs, notebooks, projectors, A/V receivers, Xbox Series X, Xbox Series S, Xbox One, PS4, PS5 & other video game consoles, monitors, UHD players, Apple TV devices, PCs, Blu-ray players

HDMI Cable, 4K 8K, 1M 2M, 3M 4M

Shenzhen GuanChen Electronics Co., Ltd. , https://www.gcneotech.com