Neuron c integer constants – Echelon Neuron C User Manual
Page 16

4
Overview
Neuron C is designed to execute in the environment provided by the Neuron
system firmware. This firmware provides an
event-driven scheduling system
as
part of the Neuron C language’s run-time environment.
Neuron C also provides a lower-level
messaging service
integrated into the
language in addition to the network variable model, but the network variable
model has the advantage of being a standardized method of information
interchange, whereas the messaging service is not standardized (with the
exception of its usage by the L
ON
W
ORKS
file transfer protocol, LW-FTP). The use
of network variables, both standard types and user types, promotes
interoperability between multiple devices from multiple vendors. The lower-level
messaging service allows for proprietary solutions in addition to the file transfer
protocol.
Another Neuron C data object is the
timer
. Timers can be declared and
manipulated like variables. When a timer expires, the system firmware
automatically manages the timer events and notifies the program of those events.
Neuron C provides many built-in
I/O models
, which are instantiated as
I/O
objects
. These I/O models are standardized I/O “device drivers” for the Neuron
Chip or Smart Transceiver I/O hardware. Each I/O model fits into the event-
driven programming model. A function-call interface is provided to interact with
each I/O object.
Some I/O models, all I/O pins, and a dedicated, high-resolution system timer, can
also be used to trigger asynchronous interrupts.
The rest of this chapter discusses these various aspects of Neuron C in more
detail, and the remaining chapters cover these aspects in greater detail,
accompanied by many examples.
Neuron C Integer Constants
Negative constants are treated as a unary minus operation on a positive
constant, for example, -128 is a signed long, not a signed short. Likewise, -32768
is an unsigned long, not a signed long. To construct a signed short value of -128,
you must use a cast:
((signed short)(-128))
To construct a signed long value of –32768, you must also use a cast:
((signed long)(-32768))
Decimal integer constants have the following default types:
0 .. 127
signed short
128 .. 32767
signed long
32768 .. 65535
unsigned long
The default type can be modified with the u, U, l, and L suffixes. For example:
0L
signed long
127U
unsigned short
127UL
unsigned long
256U
unsigned long
Hexadecimal constants have the following default types, which can also be
modified as described above with the u, U, l, and L suffixes: