LabVIEW Basics - 13 | Modular Code

Creating modular code makes applications easier to develop, debug, and maintain. In this section we'll learn about Sub VIs.

Prerequisites

Hardware


None.

Software

Procedure


Embed Video

  • A Sub VI is a chunk of reusable code.

  • Data is passed into and out of a Sub VI using terminals.
    • Create Sub VI terminals by connecting front panel Controls and Indicators to the Connector Pane.

  • Sub VI Icons help keep code easy to read and maintain.

  • Use the VI Properties to add context help to a sub VI.
    • Click File»VI Properties or Ctrl+I then select documentation.

  • To place a custom Sub VI on the block digram:
    • Select Functions Palette»Select A VI and select the sub VI
      or
    • Click and drag the VI file onto the block diagram.

  • Add code comments by double clicking anywhere on the block diagram.