ProSoft Technology MVI56E-MCM/MCMXT User Manual

Page 190

Advertising
background image

Reference

MVI56E-MCM ♦ ControlLogix Platform

User Manual

Modbus Communication Module

Page 190 of 199

ProSoft Technology, Inc.

June 18, 2014

ReadData
The R

EAD

D

ATA

task handles all new data and status information received from

the module and placing it in the proper location in the processor. Data is
transferred from the module to the processor using the module’s input image
(L

OCAL

:1:I:D

ATA

[ ]).

This task should set the last read block number

(MCM1.BP.LastRead) to the current block number sent from the module
(L

OCAL

:1:I:D

ATA

[249])

and stores the newly received read block number

(D

ATA

[249])

into the L

AST

R

EAD

variable.

Note: The _R

EAD

C

ONTROL

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 _R

EAD

C

ONTROL

rung (rung 4 in the sample R

EAD

D

ATA

task) and the

_R

EAD

C

ONTROL

and _W

RITE

C

ONTROL

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 configured with 0 for the ReadRegCnt,
then blocks -1 and 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.R

EAD

D

ATA

[

]). 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 MVI56E-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-through 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 MVI56E-MCM module.
Data is transferred from the processor to the module using the module’s output
image (L

OCAL

:1:O:D

ATA

[ ]).

This task should store the currently requested data

set in the module’s MCM.BP.L

AST

W

RITE

data object. This object is used in all

subsequent ladder logic in case the input word (L

OCAL

:1:I:D

ATA

[1])

changes

during processing.

Advertising