Neuron c variables, Neuron c variable types – Echelon Neuron C User Manual

Page 17

Advertising
background image

Neuron C Programmer’s Guide

5

0x0 .. 0x7F

signed short

0x80 .. 0xFF

unsigned short

0x100 .. 0x7FFF

signed long

0x8000 .. 0xFFFF

unsigned long

Octal constants have the following default types, which can also be modified as

described above with the u, U, l, and L suffixes:

0 .. 0177

signed short

0200 .. 0377

unsigned short

0400 .. 077777

signed long

0100000 .. 0177777

unsigned long

Binary constants have the following default types, which can also be modified as
described above with the u, U, l, and L suffixes:

0b0 .. 0b01111111

signed short

0b10000000 .. 0b11111111

unsigned short

0b0000000100000000 .. 0b0111111111111111

signed long

0b1000000000000000 .. 0b1111111111111111

unsigned long

Neuron C Variables

The following sections briefly discuss various aspects of variable declarations.

Data types affect what sort of data the 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 are optional; if omitted, they are 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;

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 the

I/O Model Reference

for more details on I/O objects, and

see the

Timers

chapter 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 discussed in
great detail in the

Functions

chapter of the

Neuron C Reference Guide

.

Advertising