Echelon Neuron C User Manual

Page 194

Advertising
background image

174

Network Variable, Configuration Property, and Message Tag Declarations

device_properties {

property-reference-list

};

property-reference-list

:

property-reference-list

,

property-reference

property-reference

property-reference

:

property-identifier

[=

initializer

] [

range-mod

]

property-identifier

[

range-mod

] [=

initializer

]

range-mod

:

range_mod_string (

concatenated-string-constant

)

property-identifier

:

cpnv-prop-ident

cp-family-prop-ident

cpnv-prop-ident

:

identifier

[

constant-array-index-expr

]

identifier

cp-family-prop-ident

:

identifier

The device property list begins with the device_properties keyword. It then
contains a list of property references, separated by commas. Each property

reference must be the name of a previously declared CP family or the name of a

previously declared configuration network variable. If the network variable is an
array, and a single element of that array is to be used as a property for the

device, specify that element with an index expression (such as var[4]) in the
device_properties clause. On the other hand, if the property is itself the

entire network variable array, specify just the array name without an index

expression (such as var, where var is declared as an array) in the
device_properties clause.
Following the

property-identifier

, there can be an optional

initializer

, and an

optional

range-mod

. These optional elements can occur in either order if both are

given. If present, the instantiation initializer for a CP family member overrides

any initializer provided at the time of declaration of the CP family; thus, using

this mechanism, some CP family members can be initialized specially, with the
remaining CP family members having a more generic initial value. If a network

variable is initialized in multiple places (in other words, in its declaration as well

as in its use in a property list), the initializations must be identical in type and
value.
The device property list appears at file scope. This is the same level as a function
declaration, a task declaration, or a global data declaration.
A Neuron C program can have multiple device property lists. These lists are

merged together by the compiler to create one combined device property list.
This feature is provided for modularity in the program (different modules can

specify certain properties for the device, but the list is combined by the compiler).

However, you cannot have more than one configuration property of any given
SCPT or UCPT type that applies to the device.
If two separate modules specify a particular configuration of the same type in the

device property lists, this situation causes a compilation error.

Finally, each property instantiation can have a range-modification string

following the property identifier. The range-modification string works identically

to the

range-mod

described

Configuration Property Modifiers (cp-modifiers)

on

Advertising