Echelon Series 6000 Chip databook User Manual
Page 130
access_nv()
access_alias()
update_nv()
update_alias()
Both the NV and Alias configuration structures can be referenced using macros named
NV_STRUCT_TYPE
and ALIAS_STRUCT_TYPE – these will work regardless of whether the
target device supports the extended address table.
For the NV_STRUCT_TYPE data type the “nv_addr_index_high” represents the upper 4-bits
of an 8-bit address table entry index. The “nv_addr_index” field represents the lower 4
bits. When using update_nv(), “nv_addr_index_high” must be set to represent the
upper 4 bits of the address table entry. For entries indexed from 0 to 15, the value would be
0. In the case where the NV is unbound, “nv_addr_index” and “nv_addr_index_high”
must both be set to 15. Correspondingly, access_nv() returns a structure with
“nv_addr_index_high” included.
For the NV Alias configuration structure the same rules apply for the use of the field
“alias_nv.nv_addr_index_high”.
The actual address table entry count must be referenced using a macro named
ADDRESS_COUNT
and not directly via “read_only_data.address_count”.
As an example, to bind network variable index 34 for address table index 6:
NV_STRUCT_TYPE nv_copy;
nv_copy = *access_nv(34);
nv_copy.nv_addr_index = 6;
nv_copy.nv_addr_index_high = 0;
update_nv(&nv_copy, 34);
118
Programming Considerations