Chapter 5
Generated Code Architecture
©
National Instruments Corporation
5-23
The BlockScript block allows you to specify conditions and actions, define
block inputs, outputs, and parameters, and specify their data types and
dimensions. BlockScript then writes the update equations that process the
inputs and parameters to produce the outputs. BlockScript I/O can be read
by the Data Dictionary. The BlockScript block is designed for general use;
however, there are special semantics that apply to the translation of the
BlockScript into code that can cause unexpected results if not fully
understood.
Inputs and Outputs
The inputs and outputs of a BlockScript block are represented by a set of
scalars or vectors. If a vector, the vector might be a fixed size, or a size
related to the number of inputs or outputs of the block.
Note
The size of the I/O variables and the number of I/O signals of the BlockScript block
are recursively related. If you change one, the other also changes.
Inputs and outputs are declared in two steps:
1.
Create the names of the variables to be used as inputs and outputs.
The order of this signature is critical as it provides a mapping to the
input/output pins of the block.
2.
Specify the data type and size of the variables.
If you do not specify a data type declaration, BlockScript assumes the
variable is a scalar float. The order within the data type declaration is not
important.
Example 5-5 shows declarations of inputs and outputs.
Example 5-5
Example BlockScript Block Input/output Declarations
inputs : (alpha, beta, gamma);
outputs: result;
float alpha, gamma(5);
integer beta(5), result(10);
-----------------------------------------
inputs : data;
outputs: control;
float data(:), control(data.size);