Error handling, Standard procedures, Structure-based interface – National Instruments AutoCode NI MATRIX User Manual

Page 119: Error handling -11, Standard procedures -11, Structure-based interface -11

Advertising
background image

Chapter 5

Generated Code Architecture

© National Instruments Corporation

5-11

AutoCode Reference

system, because ordering of the outputs in a single-rate system is
maintained. In a multi-rate system, duplicates can be safely eliminated
because of the sample and hold mechanism. The code to perform both of
these activities represent a copy from one variable to another.

Error Handling

The error handling within a subsystem is very simple. When an error is
detected, the code goes to (or throws an exception) some error handling
code. The purpose of the error handler is to cope with the error as best it
can. The error handler is completely defined in the template and you can
change the default behavior quite easily. There is only a limited set of
run-time errors that are checked for, but some blocks generate special error
handling when the

-e

option is specified for code generation.

Standard Procedures

A Standard Procedure SuperBlock represents a reusable, reentrant function
within the generated code. A Standard Procedure is internally structured
almost exactly like a subsystem, except for reusability and reentrancy.

Structure-Based Interface

This form of the interface to the Standard Procedure is conceptually the
same as that of the subsystem. The inputs, outputs and other data are
packaged into structures that are passed by pointer as actual arguments to
the function. The caller is tasked with creating instances of the structures
needed for the interface. The following briefly describes the type of
structures required for this interface.

Input—Also called the

U

-structure and contains the inputs of the

procedure. The inputs are in the order specified in the procedure
definition’s external inputs.

Output—Also called the

Y

-structure and contains the outputs of

the procedure. The outputs are in the pin-order specified by the
connections of basic blocks to the external output pins of the procedure
definition.

Info—Provides additional information that is used by the procedure to
maintain reusability and reentrancy. Data includes the

R_P

and

I_P

data for the blocks within the procedure. State data for the blocks
within the procedure appear within this structure as well. The input,
output and info structures of nested procedure SuperBlocks appear as
well. Also, %vars used in the procedure are passed by pointer to
support the partitioning capability of SuperBlocks.

Advertising