Fields. see creating, And modifying a structure or union nv or cp type – Echelon NodeBuilder Resource Editor User Manual

Page 40

Advertising
background image

6. Set the individual values of the fields in the structure, union, or the floating-point

value to the desired default or override value and then click OK to return to the
browser.

7. Right-click the configuration property, and then click Change Format on the

shortcut menu. The LonMaker Browser’s Change Format dialog appears.

8. Select Built-in Data Types from Format Files, then select Raw (Hex) from

Formats Available, and then click OK to return to the browser. If the device you
are browsing is not commissioned, you will get a warning message, which you can

ignore.

9. The value is displayed as a comma separated list of values in the Browser window.

Each value is a two-byte hexadecimal number (the browser removes leading zeroes).

10. Return to the configuration property type in the resource editor and enter the

hexadecimal value for the default or override. Prefix a zero to any single digit values

in the comma-separated list. For example, if the LonMaker Browser shows a value of
“0,5,b,36,c,3,db,” enter “00050b360c03db.”

Creating and Modifying a Structure or Union NV or CP Type

You can create network variable and configuration property types with multiple fields,
each with their own data type, by defining a type as a structure or union. The fields in a

structure are separate, whereas the fields in a union may overlap. For example, if a

structure type contained an UNSIGNED_SHORT and an UNSIGNED_LONG field, the
total size is 24 bits (8 bits for the short, and 16 bits for the long). If a union type

contained these same two fields, the total size is 16 bits; the short shares the first 8 bits
of the long. Unions and structures can both contain any data types, including other

unions and structures, with the exception of bitfields, which can be used in structures,

but not unions.
Note: While the display of the structure type bears a resemblance to Neuron C code, it is

not in Neuron C syntax, and cannot be cut and pasted directly into a Neuron C file. To

implement a variable using a network variable or configuration property type in Neuron
C version 2 or later, simply declare this variable using the type name defined in the
resource file. For example, SNVT_count MyCount; defines a variable, not a network
variable, of type SNVT_count.

To create a union or structure type, follow these steps:
1. Create a new type as described in Creating and Modifying a Network Variable or

Configuration Property Type.

2. Set Data Type to UNION or STRUCTURE. The left pane displays typedef

struct { }

or typedef union { }.

3. Right-click the typedef struct or typedef union statement, and then click

Insert Field on the shortcut menu. Enter attributes, strings, limits, and scales for

the new field as described in Creating and Modifying a Network Variable or

Configuration Property Type). Name must be a valid name for an aggregate member
in the Neuron C language, but is otherwise not limited (i.e. it does not have to start

with “UNVT” or “UCPT” for fields). Each field contains its own data type, strings,
limits, and scales. Repeat this step for each field in the structure.

4. Click OK. The new type appears in the Network Variable Types or

Configuration Property Types folder.

To make changes to a field, click the field in the left pane and modify the field definition.

32

Creating and Modifying Resources

Advertising