National Instruments AutoCode NI MATRIX User Manual

Page 28

Advertising
background image

Chapter 2

C Language Reference

© National Instruments Corporation

2-11

AutoCode Reference

Linking Handwritten UCBs with AutoCode Applications

To write code for UserCode Blocks (UCBs), refer to the

sa_user.c

file,

which is provided in your

src

distribution directory.

The

sa_user.c

file contains an example of a UCB function declaration

(refer to the

Implementing Handwritten UCBs

section). If your model has

more than one UCB, each prototype must have a unique name. Make one
or more copies of this file and insert the code that implements the
algorithm(s) of the UCB(s). One or more uniquely-named UCB code
functions can be placed inside each copy of the

sa_user.c

file and the

copies can be given any convenient names. If renamed files are included,
the names can be placed into the stand-alone file compilation script
(

compile_c_sa.sh

) for automatic compilation. If the UCB function—for

example, USR01, refer to callout 2 of Figure 2-1—is renamed, all other
occurrences of USR01 in

sa_user.c

and

sa_user.h

also must be

changed appropriately, including the occurrence in directive

$ucb

. Refer

to callout 1 of Figure 2-1.

Advertising