1. in – National Instruments AutoCode NI MATRIX User Manual

Page 121

Advertising
background image

Chapter 5

Generated Code Architecture

© National Instruments Corporation

5-13

AutoCode Reference

Note

If you specify a specific partition with the %var name in the block form (that is,

A.GAIN

), that %var is directly used, not indirectly referenced.

Example 5-1

Relevant Code to Support Partitioned %vars Within a Procedure

/* Xmath variable definitions. */

VAR_FLOAT A_GAIN;

VAR_FLOAT B_GAIN;

/******** Procedures’ declarations ********/

/******* Procedure: foo *******/

/***** Inputs type declaration. *****/

struct _foo_u {

RT_FLOAT foo_1;

};

/***** Outputs type declaration. *****/

struct _foo_y {

RT_FLOAT foo_2_1;

};

/***** Info type declaration. *****/

struct _foo_info {

RT_INTEGER iinfo[5];

VAR_FLOAT *GAIN;

};

/******* Procedure: foo *******/

void foo(U, Y, I)

struct _foo_u *U;

struct _foo_y *Y;

struct _foo_info *I;

{

RT_INTEGER *iinfo = &I->iinfo[0];

/***** Output Update. *****/

/* ---------------------------- Gain Block */

/* {foo..2} */

Y->foo_2_1 = (*I->GAIN)*U->foo_1;

iinfo[1] = 0;

Advertising