Get_current_nv_length( ) function, Syntax, Example – Echelon Neuron C User Manual
Page 104
84
Functions
when (...)
{
msg_out.tag = TAG1;
msg_out.code = 3;
msg_send();
flush_wait();
nvoVoltage = 3;
while (TRUE) {
post_events();
if (nv_update_completes(nvoVoltage)) break;
}
}
when (msg_completes(TAG1))
{
...
}
get_current_nv_length( )
Function
The get_current_nv_length( ) function returns the currently defined length of a
network variable, given the global index,
netvar-index
, of that network variable.
This is useful when working with changeable-type network variables.
Syntax
unsigned int get_current_nv_length (unsigned int
netvar-index
);
netvar-index
The global index for the network variable whose current
length is required. The global index can be obtained
through the global_index property, or through the
nv_table_index( ) built-in function.
Example
SCPTnvType cp_family cp_info(reset_required) nvType;
const SCPTmaxNVLength cp_family nvMaxLength;
network output changeable_type SNVT_volt_f nvoVolt
nv_properties
{
nvType,
nvMaxLength
=
sizeof(SNVT_volt_f)
};
void f(void)
{
unsigned
currentLength;
currentLength
=
get_current_nv_length(nvoVolt::global_index);
}
Recommendation: Use the sizeof( ) operator to obtain the length of a network
variable that is not a changeable type, or to obtain the length of the initial type of
a changeable type network variable.