External_input ( ) function, External_output ( ) function, Usercode blocks – National Instruments AutoCode NI MATRIX User Manual

Page 27: Usercode blocks -10

Advertising
background image

Chapter 2

C Language Reference

AutoCode Reference

2-10

ni.com

External_Input ( ) Function

RT_INTEGER External_Input(void)

External_Input( )

is for use in the simulation comparison mode; it

reads in external input data from your specified

FSAVE

input file. The data

appears in

XINPUT

, an array of type

RT_FLOAT

, dimensioned equal to the

input vector (

T

- and

U

-vectors) defined at simulation time. No data

conversion is required in this version of the generated code, because all data
is passed as arrays of type

RT_FLOAT

. The routine returns the value of

SCHEDULER_STATUS

, which reports on the success of the input operation

and is passed to the

External_Input( )

routine by the scheduler. In the

target version of

sa_utils.c

, the operation of this function is much the

same; every time it is called,

External_Input( )

returns an input vector

from the hardware sensors.

External_Output ( ) Function

RT_INTEGER External_Output(void)

External_Output( )

is for use in the simulation comparison mode;

it posts external output data to your specified output file. The data is
presented in

XOUTPUT

, an array of type

RT_FLOAT

, dimensioned equal to

the output

Y

vector as defined at simulation time. No data conversion is

required in this version of the generated code, because all data is passed
as arrays of type

RT_FLOAT

. The routine returns the value of

SCHEDULER_STATUS

, which is passed to it by the scheduler. In the target

version of

sa_utils.c

, the operation of this function is much the same;

every time it is called,

External_Output( )

posts an output vector to the

software data bus.

UserCode Blocks

This section describes how to link UserCode Blocks (UCBs) with
AutoCode or SystemBuild applications. AutoCode supports all
SystemBuild data types for inputs and outputs and the generation of the
fixed and variable interface options. The variable interface does not include
optional arguments to the user code—for example, states—if that argument
is not specified in the UCB. Unless otherwise stated, the following sections
describe the fixed interface option of a UCB.

Advertising