Creating and modifying a reference nv or cp type – Echelon IzoT Resource Editos User Manual

Page 42

Advertising
background image

34

Creating and Modifying Resources

bitfield can contain positive or negative values
with negative numbers values stored using twos
complement notation. Twos complement notation
is created by converting the number to binary,
complementing each bit, and adding 1 to the
resultant binary number.

A signed bitfield with a width of 1 can contain
only two values: -1 (minus one) and 0 (zero). This
is often unwanted; the developer is likely to
require an unsigned bitfield of the same width,
accepting 0 (zero) and +1 (plus one). The use of
unsigned bitfields is recommended due to a
slightly better performance on the Neuron Chip,
but also in order to avoid the common mistake of
declaring bitfields with a width of one bit as
signed.

Unlike the ANSI-C and Neuron C programming languages, resource files do not support
anonymous bitfields (bitfields that are declared with signedness and width, but without a
name, e.g. int : 3;) or bitfields with a width of 0. To control the positioning of a
bitfield within the compound byte, set the offset value accordingly. If the Resource
Editor detects a gap between bitfields, it will display a warning describing the situation
and offer to leave the gap intact, or to close the gap by adjusting the offset preferences
accordingly. Do not allow automatic adjustment if you have purposefully laid out the
bitfields to match some specific requirement.

Creating and Modifying a Reference NV or CP Type

Network variable types, configuration property types, and fields within structure or
union types can be based on existing network variable types (but not configuration
property types) that are defined within the same resource file, within the standard
resource file, or within any other resource file that has a compatible program ID
template and scope selector. When this is done, if the referenced type changes in some
way (type size, fields, etc), any configuration property and network variable types that
reference it will automatically be changed as well. To create a type based on an existing
type, follow these steps:

1. Create a new type as described in Creating and Modifying a Network Variable or

Configuration Property Type. In step 3, set Data Type to reference. Reference
Information
appears in the dialog as shown in the following figure:

Advertising