Real-Time Workshop Embedded Coder    

Sample Code Excerpts

In the model shown in Figure 4-1, block parameters and signals are associated with data objects belonging to each of the predefined custom storage classes, as follows:

Figure 4-1: Model Using Custom Storage Classes

The structure definitions for the bit field signalBit and the struct testpoints are in the generated file model_types.h, as shown in the following code excerpt. Notice also the inclusion of the generated file exportedSignals.h and the file importedSignals.h. The latter is assumed to be a hand-written file containing external signal definitions:

A code excerpt from exportedSignals.h follows, declaring the parameter eg and making it visible to externally written code:

The following excerpt from the generated file model_data.c contains the storage declarations and initializers for the parameters c, cv, and d; signals v and intl; exported signal eg; signals b1 and b2 (embedded in signalBit); and sw1 and sw2 (embedded in testpoints):

The following code excerpt from model.c illustrates the application of these variables in the generated program:


  Ordering of Generated Storage Declarations Requirements, Restrictions, Target Files