68
9.2.14 ControlLogix Example: Reading and Writing MSG Instructions
Often times, applications may need to both read data from and write data to the inverter. To accomplish
this task, multiple MSG instructions will need to be implemented in the PLC program. The configuration
and execution for implementing multiple MSG instructions is in general identical to that required for
implementing just one MSG instruction. Each MSG instruction will require its own message controller
tag.
Figure 66 shows an example of four MSG instructions, two for reading and two for writing. It is evident
from this logic that “rd_connection_1” and “rd_connection2” are the two independent message controller
tags created for the read instructions. Note the addition of the en_wr_xx XIC elements for the write logic.
The reason for the addition of these elements is that while reading from a remote device is often
continuously performed (monitoring), data is typically written to the remote device only when necessary
(i.e. when the value to write has changed). This conserves both network bandwidth and potentially
EEPROM lifespans on the target device. The en_wr_xx elements in this example, therefore, would
typically be replaced in an actual application program by user-provided logic that controls the conditions
under which write operations would be performed.
Figure 66: Reading and Writing via MSG Instructions
Figure 67 shows the configuration details of the example wr_connection_xx MSG instruction. Note that
the chosen “Message Type” is “CIP Data Table Write”, and that this instruction will only be writing to one
inverter parameter. The value of the controller tag specified in the Source Element will be written to the
inverter parameter specified in the Destination Element.
Figure 67: MSG Configuration for Writing
Note that when writing data via explicit messaging, use caution to ensure that the commanded
parameters are not also simultaneously being commanded in the background via I/O messaging.
Indeterminate behavior can occur if MSG instructions and background I/O data transfers are both writing
to the same parameters. In other words, if the I/O messaging example procedure detailed in section
9.2.12 has already been implemented, and the same program is now being modified to implement
explicit messaging, then it is recommended to inhibit the target module by selecting the “Inhibit Module”
checkbox in the Connection tab of the Module Properties dialog.