Echelon LonTal Stack User Manual
Page 108
96
Using the LonTalk Interface Developer Utility
equivalents to the built-in Neuron C types. For example, the LonPlatform.h file
contains a type definition for a Neuron C signed integer equivalent type called
ncsInt. This type must be the equivalent of a Neuron C signed integer, a signed
8-bit scalar. For most target platforms, the ncsInt type is defined as signed char
type.
A network variable declared by a Neuron C built-in type does not require a
host-side type definition in the LonNvTypes.h file, but is instead declared with
its respective host-side Neuron C equivalent type as declared in LonPlatform.h.
Network variables that use ordinary C types, such as int or long, are not
interoperable. For interoperability, network variables must use types defined
within the device resource files. These network variable types include standard
network variable types (SNVTs) and user-defined network variable types
(UNVTs). You can use the Resource Editor tool to define your own UNVT.
Example:
A model file contains the following declarations:
network input int
nviInteger;
network output SNVT_count
nvoCount;
network output SNVT_switch
nvoSwitch;
• The nviInteger declaration uses a built-in Neuron-C type, so the
LonTalk Interface Developer utility uses the ncsInt type defined in
LonPlatform.h.
• The nvoCount declaration uses a type that is not a built-in Neuron C
type. The utility produces the following type definition:
typedef ncuLong SNVT_count;
The ncuLong type represents the host-side equivalent of a Neuron C
unsigned long, a 16-bit unsigned scalar. It is defined in LonPlatform.h,
and typically maps to the LonWord type. LonWord is a
platform-independent definition of a 16-bit scalar in big-endian notation:
typedef struct {
LonByte msb;
LonByte lsb;
} LonWord;
To use this platform-independent type for numeric operations, you can
use the optional LON_GET_UNSIGNED_WORD or
LON_SET_UNSIGNED_WORD macros. Similar macros are provided
for signed words (16 bit), and for signed and unsigned 32-bit scalars
(DOUBLE).
If a network variable or configuration property is defined with an
initializer in your device’s model file, and if you change the default
definition of multi-byte scalars (such as the ncuLong type), you must
modify the initializer generated by the LonTalk Interface Developer
utility if the type is a multi-byte scalar type.
• The nvoSwitch declaration is based on a structure. The LonTalk
Interface Developer utility redefines this structure using built-in Neuron
C equivalent types: