
MVI56-MCM
♦
ControlLogix Platform
Reference
Modbus Communication Module
Page 146 of 159
ProSoft Technology, Inc.
July 24, 2008
Note: The _ReadControl routine handles the command control responses received from the
module. If command control, event command, or slave status blocks are not going to be used in
the application, then the _ReadControl rung (rung 4 in the sample ReadData task) and the
_ReadControl and _WriteControl ladder files may be removed.
If the module is configured for zero blocks, it will send blocks with identification
codes of zero and -1. These blocks will only contain status data, and no user
data will be included in these blocks.
The ladder obtains status information when the module is configured for either 1
or 0 blocks of read data. If the module is setup with 0 for the ReadRegCnt, then
blocks -1and 0 will be given by the module on the input image. If the
ReadRegCnt is 200 or less, then you will receive block 0 and block 1.
The ladder logic also determines if the new data received in the input image is
user data. If user data is present, the ladder logic will place the data in the correct
location in the processor's read data area
(MCM.ReadData[ ]
). Up to 200 data
words can be transferred in each block transfer. In addition to the user data, the
block also contains important status data. This data should be copied to the
correct data area in the module (
MCM.STATUS
). This status data can be used to
determine the "health" of the MVI56-MCM module. This rung computes offset
into the Modbus Data Table for the received data block and to store the data into
the Modbus Data Table.
If the requested block is within the valid range of data blocks for the Modbus
Data Table, the offset into the table is computed as (Block ID number - 1) * 200.
This is the starting offset in the Modbus Data Table where the 200 bits of data
will be stored.
When the processor receives a pass-thru block the received data will be handled
at the _Pass-Thru routine. If the module is being used as a Modbus Master
(PortX.Type=0) or a standard Modbus Slave (Port X.Type = 1) then this rung of
logic and the _PassThru routine are not required. If the module is being used as
PortX.Type = 2 to 4, then this rung and ladder routine is required.
WriteData.
The WriteData task sends data from the processor to the MVI56-MCM module.
Data is transferred from the processor to the module using the module's output
image (Local:1:O:Data[ ]). This task should store the currently requested data set
in the module's MCM.BP.LastWrite data object. This object is used in all
subsequent ladder logic in case the input word (Local:1:I:Data[1]) changes during
processing.
Note: The _WriteControl routine handles the command control blocks sent to the module. If
command control, event command, or slave status blocks are not going to be used in the
application, then the _WriteControl rung (rung 7 in the sample WriteData task) and the
_ReadControl and _WriteControl ladder files may be removed.