Echelon NodeBuilder FX User Manual

Page 197

Advertising
background image

NodeBuilder FX User's Guide

183

the declaration of CP families or configuration network variables. The Neuron C language does
not permit the use of const with auto.

extern declares a data item or function that is defined in another module, in a library, or in the

system image.

static declares a data item or function which is not to be made available to other modules at link

time. Furthermore, if the data item is local to a function or to a when()task, the data value is to be
preserved between invocations, and is not made available to other functions at compile time.

In addition to the ANSI C storage classes, Neuron C provides the following classes and class
modifiers:

network begins a network variable declaration. See Chapter 3, How Devices Communicate Using

Network Variables, of the Neuron C Programmer’s Guide for more details.

uninit when combined with the eeprom keyword (see below), specifies that the EEPROM

variable is not initialized or altered on program load or reload over the network.

The following Neuron C keywords allow you to direct portions of application code and data to
specific memory sections.

eeprom

far

offchip (only on Neuron Chips and Smart Transceivers with external memory)
onchip

These keywords are particularly useful on the Neuron 3150 Chip and 3150 Smart Transceivers,
since a majority of the address space for these parts is mapped off chip. See Using Neuron Chip
Memory
in Chapter 8 of the Neuron C Programmer’s Guide for a more detailed description of
memory usage and the use of these keywords.

Variable Initialization

Initialization of variables occurs at different times for different classes. The const variables,
except for network variables, must be initialized. Initialization of const variables occurs when the
application image is first loaded into the Neuron Chip or Smart Transceiver. The const ram
variables are placed in off-chip RAM that must be non-volatile. The eeprom and config variables
are also initialized at load time, except when the uninit class modifier is included in these variable
definitions.

Automatic variables cannot be declared const because Neuron C does not implement initializers in
declarations of automatic variables.

Global RAM variables are initialized at reset (specifically when the device is reset or powered up).
By default, all global RAM variables (including static variables) are initialized to zero at this time.

Initialization of I/O objects, input network variables (except for eeprom, config, config_prop, or
const network variables), and timers also occurs at reset. Zero is the default initial value for
network variables and timers.

Local variables (except static ones) are not automatically initialized, nor are their values preserved
when the program execution leaves the local scope.

Neuron C Declarations

The Neuron C Version 2.2 programming language and ANCI C both support the following
declarations:

Advertising