Msg_tag_index variable, Nv_array_index variable, Nv_in_addr variable – Echelon Neuron C User Manual

Page 214

Advertising
background image

194

Built-In Variables, Objects, Symbols, and Semaphore

Example 1:

signed long switch_state;

when (io_changes(switch_in))
{
switch_state = input_value;
}

Here, the value of the network variable switch_state is set to the value of
input_value (the switch value that was read in the io_changes clause).
However, there are some I/O models, such as pulsecount, where the true type of

the input value is an unsigned long. An explicit cast should be used to convert
the value returned by input_value to an unsigned long variable in this case.
Example 2:

unsigned long last_count;
IO_7 input pulsecount count;

when (io_update_occurs(count))
{

last_count = (unsigned long)input_value;

}

msg_tag_index

Variable

The msg_tag_index variable contains the message tag for the last msg_completes,

msg_succeeds, msg_fails, or resp_arrives event. When one of these events
evaluates to TRUE, msg_tag_index contains the message tag index to which the

event applies. The contents of msg_tag_index is undefined if no input message

event has been received. The type is unsigned short.

nv_array_index

Variable

The nv_array_index variable contains the array index for a nv_update_occurs,

nv_update_completes, nv_update_fails, nv_update_succeeds event. When one of

these events, qualified by an unindexed network variable array name, evaluates
to TRUE, nv_array_index contains the index of the element within the array to

which the event applies. The contents of nv_array_index will be undefined if no

network variable array event has occurred. The type is unsigned int.

nv_in_addr

Variable

The nv_in_addr variable contains the source address for a network variable

update. This value can be used to process inputs from a large number of devices
that fan-in to a single input on the monitoring device. When the devices being

monitored have the same type of output, a single input network variable can be

used on the monitoring device. The connection would likely include many output
devices (the sensors) and a single input device (the monitor). However, the

monitoring device in this example must be able to distinguish between the many

sensor devices. The nv_in_addr variable can be used to accomplish this.

Advertising