Invoking generated procedures directly, Invoking generated procedures directly -22 – National Instruments AutoCode NI MATRIX User Manual

Page 39

Advertising
background image

Chapter 2

C Language Reference

AutoCode Reference

2-22

ni.com

Linking Procedures with Real-Time Applications or Simulator

Generate reusable procedures from your Procedure SuperBlocks as
described in this chapter and in Chapter 3,

Ada Language Reference

. To

link generated reusable procedures with your own application or simulator
you have the three following options:

Invoke the generated algorithmic procedure directly (refer to callout 2
of Figure 2-4), passing it pointers to structure objects as arguments.

Invoke the re-entrant UCB wrapper routine generated to link with
SystemBuild UCBs (refer to callout 3 of Figure 2-4), passing it
arguments, which are pointers to arrays and values.

Invoke the generated non-reentrant subsystem function, which invokes
the procedure.

The first option is more efficient for performance reasons, but might not be
the easiest to use. The second option provides ease of use in terms of
argument list and re-entrancy, but is the least efficient in some cases. The
third option also provides ease of use in terms of argument list, but although
the procedure itself is re-entrant, the subsystem invoking the procedure is
not re-entrant.

Invoking Generated Procedures Directly

To invoke a generated algorithmic procedure directly from your own
application, you must have thorough understanding of the arguments to the
procedure. When this is achieved, several steps need to be taken to invoke
the procedure.

The model in Example 2-1 contains a Procedure SuperBlock named

proc

with a time delay block and a BlockScript block. The arguments to the
generated procedure corresponding to Procedure SuperBlock

proc

are

shown in Figure 2-5.

Example 2-1

Model with Procedure SuperBlock

Depending on the nature of the application, complete the following steps to
invoke the procedure:

1.

Create an object of type

_

procedure name_u

and copy in the inputs

to the procedure. A pointer to this object will be passed as argument U
to the procedure.

2.

Create an object of type

_

procedure name_y

where the outputs of

the procedure will be stored. A pointer to this object will be passed as
argument Y to the procedure.

Advertising