Connecting message tags, Explicit addressing – Echelon Neuron C User Manual
Page 142

130
How Devices Communicate Using Application Messages
#define OFF 0
#define ON 1
// I/O Declaration
IO_4 input bit io_switch_in;
// Message tag declaration
msg_tag TAG_OUT;
// Event-driven code
when (reset) {
io_change_init(io_switch_in);
}
when (io_changes(io_switch_in)) {
// Set up message code based on the switch state
msg_out.code = (input_value == ON) ? LAMP_ON : LAMP_OFF;
// Set up message tag and send message
msg_out.tag = TAG_OUT;
msg_send();
}
Connecting Message Tags
Every device has a default msg_in input message tag. Network integrators use a
network tool to connect message tags for outgoing messages to the msg_in input
message tag. For example, message tags for the two example devices are
connected as follows:
TAG_OUT
connects to
msg_in
on the switch
on the lamp
device
device
Explicit Addressing
You can explicitly specify a destination address for application messages and
network variables using the data structures in the
must assign appropriate values to all applicable fields of one of the elements of
the dest_addr union in the msg_out object, prior to calling msg_send( ). The
message still needs a message tag, although no addressing information is derived
from the message tag. Thus, no matter how the message tag is bound, explicit
addressing overrides the address specified by the tag.
When you assign an explicit destination address, the message tag is only relevant
for correlation with response and completion event processing. However, if you
use a standard message tag, you still consume an address table entry, even if you
only use the message tag for explicitly addressed messages. To permit a more
optimal use of Neuron resources, use
non-bindable
message tags that carry no
addressing information and do not consume an address table entry. Use the
following syntax to declare a non-bindable message tag:
msg_tag bind_info(nonbind [,
other-info
])
tag-name
;