Chapter 2 C Language Reference
AutoCode Reference 2-18 ni.com
applications, make sure you adapt the same algorithm in the body of a
function using the AutoCode UCB arguments as in sa_user.c.
Variable Interface UCB
The preceding sections described the fixed interface; however, a UCB can
also use the variable interface option. For information on how to specify the
variable interface option, refer to the SystemBuild User Guide. When a
model containing a variable interface UCB is generated, the code to call the
UCB varies depending upon the data types and optional arguments
specified by the UCB. For example, if the UCB does not have any states,
arguments related to states are not passed. The following sections describe
what AutoCode generates for the variable interface.
Interface Ordering
The variable interface consists of arguments required to meet the
specification of the UCB. These arguments are passed relative to a fixed
total ordering of all possible arguments. The following is the total ordering.
Refer to Table 2-5 for descriptions of the arguments:
INFO, T, {u1, u2, ...}, {y1, y2, ...}, {X[], XD[], NX},
{R_P, NRP}, {I_P, NIP}
Note Arguments shown within braces {} are related; either all or none of these arguments
will be generated.

Interface Examples

The following samples of generated code are based on the specification of
a UCB.
/* INFO not used; T used; 2 inputs; 1 output; */
usr01(TIME, in1, in2, &out1);
/* INFO not used; T not used; 1 input; 5IPs */
usr02(in1, &IP[0], 5);
/* INFO used; T not used; 1 output; 4 states */
usr03(&info, &out1, &X[0], &XD[0], 4);
Inputs and Outputs
The fixed interface requires that all inputs and outputs be the floating-point
(RT_FLOAT) data type. However, the variable interface supports all data
types for the inputs and outputs of the UCB. Consequently, this aspect of
the variable interface can lead to errors.