ProSoft Technology MVI56E-MCM/MCMXT User Manual
Page 189

MVI56E-MCM ♦ ControlLogix Platform
Reference
Modbus Communication Module
User Manual
ProSoft Technology, Inc.
Page 189 of 199
June 18, 2014
4 Repeat these steps until you have copied all of the data types from the
sample program into your existing application.
Note: Data types prefixed with an underscore [_]
are used in optional routines, and need not be
copied unless your application requires them. Refer to MVI56E-MCM MVI56E-MCM User Defined
Data Types (page 154) for a description of the usage for each data type.
Copying the Sample Ladder Logic
Next, copy the Sample Ladder Logic from the sample program to your existing
program.
1 In the C
ONTROLLER
O
RGANIZATION
pane in the Sample Program, expand the
T
ASKS
folder until the list of program routines is visible.
2 In the Sample Program window, select one routine at a time, and then drag
the routine to the MainProgram folder in your existing program.
3 Save your program.
The sample program contains the following tasks.
MainRoutine
The M
AIN
R
OUTINE
checks for the presence of new read data from the module for
the processor. The module cycles through its list of read blocks to transfer data
from the module to the processor. Whenever new data is available, the module
will set the value for the block in
the module’s input image
(L
OCAL
:1:I:D
ATA
[249]).
The ladder logic must constantly scan this input word for
a new value. The ladder logic should only perform the R
EAD
D
ATA
and
W
RITE
D
ATA
tasks, in that order, when a new value is present in
L
OCAL
:1:I:D
ATA
[249],
otherwise data may be lost or scrambled.
If the new data is available, the L
AST
R
EAD
and word (249) will not be equal. This
will force the program to call the R
EAD
D
ATA
subroutine to process the new data
received. After the new data is placed in the Modbus Data Table, the program
will send new data to the module using the W
RITE
D
ATA
subroutine.