How do you document your code with built-in tools in LabVIEW?

Use a typedef cluster and a single feedback node; check the conditions once per iteration based on the previous iteration, and write only to the specific value when necessary, to improve clarity. Find more tips on documentation in LabVIEW in the blog post.

Everyone has undoubtedly encountered undocumented code at some point, like the example shown at the top of the image, and asked themselves questions such as:

    • Why was this code written?
    • What are the conditions for execution?
    • Why do the conditions for the case structures depend on the VI’s output?
    • Why is this output inverted?

However, the above questions could have been avoided with a small effort to document the code using the built-in tools in LabVIEW.

In the lower part of the image, I have outlined a few points on how to document a VI using the simplest tool in LabVIEW. I have used the Cluster data type together with a feedback node to handle the data in each iteration, as these provide good documentation of the available data. And by adding labels and subdiagram labels for the case structures, understanding of the execution process becomes much clearer.

An important point to mention is also that these tools are available in all versions of LabVIEW.

Learn more about LabVIEW

Start documenting your code today!

My intention in writing this blog post was to highlight the importance of documentation in order to reduce complexity for the reader and to reduce errors in the code in the future.

Latest releases

Error handling in LabVIEW [2:4]

Error handling in LabVIEW [2:4]

This post [2:4] is part of a series by GPower’s software developer, Jesper Kjær Sørensen, on building robust software and test systems. Do you know the feeling…? “But it worked on my machine!” That’s the mantra of every programmer who hasn’t mastered error handling. Of course, you would never say

Read more »
Two new Certified LabVIEW Developers at GPower

Two new Certified LabVIEW Developers at GPower

Big congratulations to Serkan Akbulut and Jakob Alsaker, who last week achieved the Certified LabVIEW Developer (CLD) certification—an internationally recognised validation of skills in developing professional and maintainable LabVIEW applications. The Certified LabVIEW Developer certification, which among other things focuses on code quality, documentation, and architecture, is the second level

Read more »

Read our other blog posts

Avoid letting your error codes become the new Blue Screen of Death [3:4]
Avoid letting your error codes become the new Blue Screen of Death [3:4]
Try GPower IO-Link for LabVIEW and TestStand FREE for 90 days!
Get 90 days of free access to the GPower IO-Link toolkit [Direct integration with LabVIEW and TestStand]
GPower and IDA launch free LabVIEW course for students and recent graduates
GPower and IDA launch free LabVIEW course for students and recent graduates