Chapter 9 Global Scope Signals and Parameterless Procedures
© National Instruments Corporation 9-9 AutoCode Reference
Connection to External OutputIf a signal that is used as input to a Global Scope procedure input or a
Global Scope procedure output is connected to a external output pin,
be aware that the external output pins will be updated at the end of that
subsystem during the subsystem copy-back phase. Thus, if you reuse the
Global variable representing that signal, by reusing the procedure, you will
see the last value of that global signal for each of its external output
connections. In this case, NI recommends copying the global variable after
each use through a gain block and connect that block output to the external
output pin.
RecommendationsNI recommends applying the following steps to your design if you intend
to use parameterless procedures. Notice that many of these items have
direct parallels to what you would expect if you were hand-coding using
global variables.
Naming ConventionAdopt a model-wide naming convention for the global variables used for
passing data into and out of the parameterless procedure. You might want
one style for inputs and another for outputs.
Model DocumentationUse the Text Block extensively to document both the procedure definition
and each procedure reference. This will help indicate what the expectation
is for the procedure. Concentrate on describing the interface of the
procedure as well as sequencing assumptions.
Explicit SequencingAs an added safety measure, you might want to use the Sequencer Block to
insure the proper ordering of blocks that affect global variables. This is
critical when you are reusing a parameterless procedure or even the global
variable itself.