beautypg.com

Neuron c variables, Neuron c variable types – Echelon Mini FX User Manual

Page 79

background image

66 Developing

Device

Applications

Timers may be automatically reloading (repeating), or one-shot timers, with a duration

ranging from 0.001–65,535 seconds.

Neuron C supports programmable hardware timer units through a variety of I/O library

functions. These functions provide a resolution up to 1 MHz (1 µs) or better, subject to

the selected I/O model, Neuron type, clock speed, and other factors (see the I/O Model
Reference
for more information). The Series 5000 chips also support a configurable

high-resolution system timer, which can be used to generate periodic interrupt requests.

Neuron C supports up to 35 different I/O models, ranging from simple bit Direct I/O

models for typical input or output hardware to complex Timer/Counter models for triacs.

Neuron C also includes serial and parallel I/O models for serial and parallel
communication busses. 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. The function-call interfaces are optimized for their respective I/O

models, yet they are similar to each other so that they are easy to use.

Neuron C Variables

The following sections briefly discuss various aspects of Neuron C-specific variable

declarations. Data types affect what sort of data a variable represents. Storage

classes affect where the variable is stored, whether it can be modified (and if so, how
often), and whether there are any device interface aspects to modifying the data.

Neuron C Variable Types

Neuron C supports the following C variable types. The keywords shown in square

brackets below are optional. If omitted, they will be assumed by the Neuron C

language, per the rules of the ANSI C standard:
[signed] long [int] 16-bit

quantity

unsigned long [int] 16-bit quantity

signed char

8-bit quantity

[unsigned] char

8-bit quantity

[signed] [short][int] 8-bit quantity

unsigned [short][int] 8-bit

quantity

enum

8-bit quantity (int type)

Neuron C provides some predefined enum types. One example is shown below:
typedef enum {FALSE, TRUE} boolean;
You should use the unsigned int type whenever possible because it is the type best
supported by the Neuron Chip and Smart Transceiver’s hardware architecture. The

unsigned int type is preferred over signed int type.

Neuron C also provides predefined objects that, in many ways, provide the look and feel

of an ANSI C language variable. These objects include Neuron C timer and I/O objects.

See Chapter 2 of the Neuron C Programmer’s Guide for more details on I/O objects, and
see Chapter 4 in the Neuron C Reference Guide for more details on timer objects.
The extended arithmetic library also defines float_type and s32_type for IEEE 754 and
signed 32.bit integer data respectively. These types are detailed further in Chapter 3 of

the Neuron C Reference Guide.