Creating and modifying a bitfield – Echelon IzoT Resource Editos User Manual
Page 41
IzoT Resource Editor User's Guide
33
3. Set Enum Scope to the scope of the resource file set containing the enumeration
type. You can select an enumeration type from the resource file set containing the
type you are creating, or from any resource file set with a numerically lower scope
and matching program ID template. File Path is automatically updated to the path
of the resource file set with the appropriate scope and program ID type. Enum Set
is updated to contain all enumerations available in that resource file set.
4. Select the enumeration type to use in Enum Set. Minimum and Maximum display
the minimum and maximum values for the selected enumeration type. You can use
these values to further restrict the range of available values for this type.
5. Continue creating the network variable or configuration property type as described in
Creating and Modifying a Network Variable or Configuration Property Type.
Creating and Modifying a Bitfield
You can define a field of a structure as a bitfield. This data type is defined as a Neuron C
bitfield. A bitfield is packed into a byte that can have from 1 to 8 bitfields that can each
be 1 to 8 bits, for a total of no more than 8 bits per byte (for example, you can have one 8-
bit field, two 4-bit fields, or 8 1-bit fields in a byte, or various combinations of these).
Two subsequent bitfields whose total size exceeds the 8 bit boundary automatically cause
a gap of unused data between the fields. To create a bitfield, follow these steps:
1. Create a new structure or union type as described in Creating and Modifying a
Structure or Union NV or CP Type. Set Data Type to ENUMERATED for the
bitfield.
2. Enter the following information:
Size
The size of the bitfield, in bits, from 1 to 8. The
bitfield size determines the maximum value the
field can contain. An unsigned bitfield of W bits
width can accept values 0..2
W
-1, a signed bitfield
of width W can hold values -2
W/2
..+2
W/2
-1
Offset
The offset of the bitfield within the byte. A full
byte is always required regardless of how many
bits in the bitfield are used. This value
determines where in the byte the values will be
set. This value can be from 0 to (8 – Size).
Signed/Unsigned
Specifies a signed or unsigned value. An unsigned
bitfield can only contain positive values. A signed