Global Storage; Percent Vars (%Var); Global Variable Blocks; Sequencing Variable Blocks - National Instruments AutoCode NI MATRIX Reference

National instruments ni matrixx reference manual
Table of Contents

Advertisement

Global Storage

Percent vars (%var)

Global Variable Blocks

© National Instruments Corporation
In a strict modular programming paradigm, global storage is strictly
avoided. However, global storage can be used safely and provides
significant benefits in terms of code size and speed. Traditionally,
AutoCode generates code that enforces a policy of safe access to global
data. However, the need for potentially unsafe uses of global memory to
achieve tight and efficient production code requires more latitude in the
code generation, and requires a lot of effort to design properly. There is the
possibility of losing determinacy and reentrancy.
Percent vars represent parameterized data specified within some
SystemBuild Blocks. A %var is generated as a global variable. AutoCode
uses a %var variable in a read-only context. If a %var parameter can be
written to, as in the case of passing parameters to a UCB, duplicate data is
generated to allow the data to change, but at the same time, not affect the
read-only uses. Notice that a %var value can be changed as part of a startup
procedure SuperBlock. Refer to the
Global Variable Blocks are implemented as global variables in the
generated code. AutoCode sequences and generates code that provides a
safe and deterministic use of variables blocks. You must generate variable
block callouts to form a critical section to maintain integrity of the global
variable blocks when used in a pre-emptive multi-tasking system. This
safety can be expensive if performance is an issue and you might not get
the behavior you want because of the special sequencing.

Sequencing Variable Blocks

The sequence when a read from and write to a variable block occurs is
critical in maintaining determinacy. The following is a summary of when
the block will execute.
Read-From Variable Block (ALL Addressing mode)—These
blocks execute before any other type of block within the subsystem,
procedure, or sequence frame. The data from the variable block is
copied into local variables. These local variables are accessed in place
of the actual global variable.
Chapter 5
Startup
5-3
Generated Code Architecture
section for details.
AutoCode Reference

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AutoCode NI MATRIX and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Autocode ni matrixx

Table of Contents