Function directory, Abs( ) built-in function – Echelon Neuron C User Manual

Page 89

Advertising
background image

Neuron C Reference Guide

69

Using the NXT Neuron C Extended Arithmetic
Translator

You can use the NXT Neuron C Extended Arithmetic Translator to create

initializers for signed 32-bit integers and floating-point variables in a Neuron C
program. To use the NXT translator, open a Windows command prompt and

enter the following command:

nxt

input-file

output-file

(where

input-file

contains Neuron C variable definitions)

The source file can contain only one variable per line. Initializers of float_type,

and SNVT_<xxx>_f variables are converted appropriately.

The output file is generated with properly converted initializers. Unaffected lines

are output unchanged. The output file can be included in a Neuron C application
with the #include directive. The output file is overwritten if it exists and was

generated originally by this program.
In some cases, such as for structs and typedefs, the translator cannot identify
signed 32-bit or floating-point initializers. These can be identified by adding ‘s’ or

‘S’ (for signed 32-bit integers), or ‘f' or 'F' (for floating-point values) to the end of

the constant.

As an example, if the input file contains the following statements:

s32_type var1 = 12345678;
struct_type var2 = {0x5, "my_string", 3333333S};
float_type var1 = 3.66;
struct_type var2 = {5.66f, 0x5, "my_string"};

then the output file will contain the following:

s32_type var1 = {0x00,0xbc,0x61,0x4e} /* 12345678 */;
struct_type var2 = {0x5,

"my_string", {0x00,0x32,0xdc,0xd5} /* 3333333 */};


float_type var1 = {0,0x40,0,0x6a,0x3d71} /* 3.66 */;
struct_type var2 = {{0,0x40,1,0x35,0x1eb8} /* 5.66 */, 0x5,
"my_string"};

Note: Users of the NodeBuilder Development Tool can also use Code Wizard to
generate initializer data for s32_type and float_type network variables or

configuration properties.

Function Directory

The following sections list the Neuron C functions alphabetically, providing
relevant syntax information and a detailed description of each function.

abs( )

Built-in Function

The abs( ) built-in function returns the absolute value of

a

. The argument

a

can

be of short or long type. The return type is unsigned short if

a

is short, or

unsigned long if

a

is long.

Advertising