Chapter 16
Program Design
©
National Instruments Corporation
16-3
Create the Program
Now you are ready to create the program in G:
•
Use a modular approach by building subVIs where you find a logical
division of labor or the potential for code reuse.
•
Solve your general problems along with your specific ones.
•
Test your subVIs as you create them. You might need to construct
higher-level test routines, but you can catch the bugs in one small
module more easily than in a hierarchy of several VIs.
As you consider the details of your subVIs, you might find that your initial
design is incomplete. For example, you might realize you need to transfer
more information from one subVI to another. You might have to reevaluate
your top-level design at this point. Using modular subVIs to accomplish
specific tasks makes it easier to manage your program reorganizations.
Plan Ahead with Connector Panes
If you think that you might need to add additional inputs or outputs later on,
select a connector-pane pattern with extra terminals. You can leave these
extra terminals unconnected. With these extra terminals, you do not have
to change the connector pane for your VI if you find you need another input
or output later. This flexibility enables you to make these changes with
minimal effect on your hierarchy.
When linking controls and indicators to the connector, place inputs on the
left and outputs on the right. This prevents complicated, unclear wiring
patterns in your VIs.
If you create a group of subVIs that are used together often, try to give the
subVIs a consistent connector pane, with common inputs in the same
location. You then can remember where to locate each input more easily
without using the Help window. If you create a subVI that produces an
BAD Input
Location
GOOD Input
Location
OK Output
Location
OK Input
Location
BAD Output
Location
GOOD Output
Location