Introduction to neuron c code editing – Echelon IzoT NodeBuilder User Manual

Page 192

Advertising
background image

Declaration

Example

Pointers

char *p;

Functions

int f(int a, int b);

Arrays

int a[4];

Structures and unions

struct s {
int field1;
unsigned field2 : 3;
unsigned field3 : 4;
};

The Neuron C Version 2.3 programming language also supports the following declarations:

Declaration

Example

I/O objects

IO_0 output oneshot relay_trigger;

Timers

mtimer led_on_timer;

Network variable

network input SNVT_temp nviTemperature;

Configuration Properties

SCPTdefOutput cp_family cpDefaultOut;

Functional Blocks

fblock SFPTnodeObject { … } myNode;

Introduction to Neuron C Code Editing

The Neuron C source code generated by the NodeBuilder Code Wizard provides the framework for
your device application. It implements the device interface that you have defined, but it only
implements basic device functionality. The functionality supplied by Code Wizard includes the most
common tasks required for interoperable device and functional block management, but it does not
include any code implementing your application’s core algorithms. You can implement your device’s
functionality by editing your device application’s Neuron C source code in the Edit pane of the
NodeBuilder Project Manager to.

In addition to network variable, configuration property, and functional block declarations that comprise
the device interface, the Neuron C code generated with the NodeBuilder Code Wizard also contains the
following features:

Skeleton when() task for functional blocks or functional block arrays. The when() task

provides notification upon incoming network variable updates for the functional block or
functional block array. If the functional block has no input network variables, no when() task is
generated.

Default implementation for handling of system events. System events include when reset,

online, offline. These system events also get routed to the different director functions, allowing
each functional block director function to respond to each event in an appropriate way.

Code handling device and functional block requests on the Node Object. The Code Wizard

generates code for the nviRequest and nvoStatus network variables on the Node Object
functional block. This implementation routes requests to the functional block or blocks concerned
by calling the relevant director functions, and provides a default implementation that allows for
the following requests to be honored: RQ_REPORT_MASK, RQ_UPDATE_STATUS,
RQ_DISABLED, RQ_ENABLE. Handling for other requests is partially implemented but must
be completed by the developer. The C language comments supplied in the source files generated
by the Code Wizard describe the aspects and ramifications of various interoperability procedures.
For more information, see the LonMark Application Layer Interoperability Guidelines.

178

Developing Device Applications

Advertising