Professional Documents
Culture Documents
0
MODBUS RTU/ASCII PROTOCOL
PL1000E
MVI56-MCM
Understand basic programming principles including, but not limited to, data types, string
handling, simple scripting and use of data structures and arrays.
Familiarization with modbus communications standards, serial port functionality and wiring for
RS-232, RS-422, and RS-485 serial protocols.
PLC Ladder Logic Programming experience with Control Logix 5000 or other symbol based
ladder logic development.
page 1 of 25
This guide assumes that the user has reviewed the “System Operation Testing and Adjusting Guide for the
PL1000E ECM RENR8091” and understands the procedures required to create and load a valid Parameter
Control List (PCL) file.
This integration sample project consists of the following hardware and software components:
Ethernet
Program
Interface
CDL
Back Plane
Rockwell
Cat Electronic Prosoft
PL1000E Control Logix
Controller MV156-MCM
5000
RS-232/422/485
MODBUS
Sample System Diagram
Figure 1
The MVI56-MCM module supports 1 configuration communications port and 2 modbus compatible communication
ports that are configurable for either RS-232, RS-422, or RS-485 connections.
Cable connections and wiring schematics are provided in the “ProSoft InRax MVI56-MCM User Manual”
dated January 2005 . (http://www.prosoft-technology.com/content/view/full/2717)
Baud Rate and other port configuration settings are downloaded via the PLC program and will be discussed later
in this guide in detail.
Using the sample PLC Control Logix program as a base, this guide will jump start integration of the PL1000E
communications and ProSoft MVI56-MCM module.
page 2 of 25
Open the sample PLC program using RS Logix 5000 software, look for the Controller MVI56-MCM folder in the
controller organizer list box to the left, and then right click the “properties” tab. The controller properties window
will appear.
Figure 2
Verify that the Controller type, Revision, Chassis Type, and slot exactly match the application to be integrated.
If the MVI56-MCM module must be placed in a slot in the rack other than slot 2 as described in the sample
program, the program IO configuration must be changed to reflect the actual position. Control Logix software
automatically updates all code locations for you if the slot address is modified offline using the module properties
window prior to download.
Procedure for changing MVI56-MCM module location within the Control Logix Local I/O Chassis.
Figure 3
page 3 of 25
Expand the I/O Configuration folder to view the installed modules. Verify that the MVI56-MCM is installed.
If the module is not installed then add it now following the procedure given in the “ProSoft InRax MVI56-MCM
User Manual” dated January 2005.
Download the sample project to the PLC, the default filename of the sample project is “MVI56MCM” although any
filename may be used.
Figure 4
page 4 of 25
Controller Tags
The MCM User Manual provides a complete explanation of how the data is transferred and stored between the
PLC and the MCM, however a brief discussion regarding the MCM dataset as it relates to the Communications
settings follows here for the purpose of giving the reader a basic understanding.
Figure 5
Select the “Controller Tags” item from the controller organizer list box. Expand the MCM dataset and display the
objects it contains.
Figure 6
Understanding the MCM dataset layout is integral to understanding how the MCM module works, and each item
will be discussed in more detail later in this guide as needed, a complete discussion however may be found in the
MCM User Manual.
The data structure subsets that affect port configuration are MCM.CFG_Port, MCM.Port1, and MCM.Port2.
page 5 of 25
MCM.Port1
Each MCM.Port1 dataset item shown below is defined in the “ProSoft InRax MVI56-MCM User Manual” dated
January 2005. This is only a brief description of how the sample project utilizes the MCM module, for more
detailed information reference the Prosoft website and manual.
(http://www.prosoft-technology.com/content/view/full/2717)
Figure 7
page 6 of 25
Configuration
Port
Baud rate 57600
Parity None
Data bits 8
Stop bits 1
Modbus
Comm Port 1
Baud rate 9600
Parity None
Data bits 8
Stop bits 1
Modbus
Comm Port 2
(not used in
sample project)
MVI56-MCM, Front Panel View
Figure 8
Figure 9 provided for reference only, for current updates and detailed information visit prosoft website
(http://www.prosoft-technology.com/content/view/full/2717)
Port1 Configuration
In the sample application, Port 1 of the MCM Module is configured to operate as a Master on the modbus network
with an ID of 0 at 57.6 kbps. Up to 100 commands can be stored in the dataset with command timeout after 1
second of no response from the module.
Communication errors are written to the location as defined in the MCM.Port1.CmdErrPtr dataset array element.
(Register 2600 in the example project)
Ports 1 and 2 may be configured as RS-232, RS-422, or RS-485 via the hardware jumper settings depicted in the
diagram above.
NOTE:
Make certain that the baud rate, parity, and stop bits setup for Port 1 matches the setup at the PL1000E
communications port.
page 7 of 25
MCM.ModDef
The MCM.Moddef dataset establishes boundaries for the data mapped between the MVI56 module and PLC, this
configuration block determines the size and location of both the read and write blocks. The sample program
reserves 600 registers for write data and 2000 registers for read data. Allocating these registers does not cause
data to transfer, commands must be issued to initiate actual data transfer.
Figure 10
The two data areas depicted below are potential storage areas, no data actually transfers unless there is a
command in the command list for it to do so. The MCM dataset storage locations correspond with modbus
registers once a command is issue to create a transfer.
The data is moved according to how its mapped in the PCL file, modbus 40001 corresponds to
MCM.ReadData[0], 40002 corresponds with MCM.ReadData[1] and so on. Write data is mapped in a similar
fashion.
MCM.CmdErrPtr
Register 2600
Internal MVI56-MCM Register Stack 0 to 2800 registers Comm Error will
be loaded here
MCM.WriteData[600] MCM.ReadData[2000]
page 8 of 25
Command List MCM.P1Cmd
MCM.P1Cmd is an array of command datasets with each element of the array containing 1 command. The
sample project allows 100 commands and uses the first 5 commands for generating modbus commands that get
data from the PL1000E and transfer it to the MCM.ReadData array.
MCM.P1CMD[0] MCM.P1CMD[1]
Figure 12 Figure 13
MCM.P1CMD[2] MCM.P1CMD[3]
Figure 14 Figure 15
MCM.P1CMD[4]
Figure 16
Main Program
There are two basic subroutines that manage the actual data transfer between the MCM and the PLC data
registers. The main program calls these two subroutines each time the MCM reports that new data is present at
the port.
Figure 17
This Portion of the Sample Project was downloaded from the Prosoft Website and modified. The unmodified
program can be downloaded from http://www.prosoft-technology.com
page 9 of 25
Parameter Selection, Configuration and Display
The Parameter Translation Editor is used to select parameters and build a PCL file that will load into the PL1000E
Communications Module. The illustrations here are for reference only, a complete discussion of the Parameter
Translation Editor embedded in the service Tool may be found in the “System Operation Testing and Adjusting
Guide for the PL1000E RENR8091.” Figure 18 illustrates using the service tool to build a parameter control list
(PCL) file for the PL1000E.
Figure 18
Once the parameters have been selected a report can be generated using the parameter list report button. The
report illustrated in figure 19 will pop-up. This report may be saved as a comma separated variable file for
printout or future reference.
Figure 19
page 10 of 25
Parameter Selection, Configuration and Display
The list of parameters below were selected for use in the sample project and are shown along with the information
needed to configure each one of them for display. The sample program uses a table format to collect and display
data parameters. The elements are, Register starting address, DSI support, Length, Resolution, etc. each is
entered in the A_Interface_Config table at any one of the 2000 available array element locations.
* Data Status Indicators, (DSI) codes are present when the data is invalid. The code explains the reason for the failure. A
complete discussion of DSI codes is found in the “Systems Operations Testing and Adjusting Guide for the PL1000E ECM
RENR8091”.
PCL List
The list of parameters above is a depiction of the sample project PCL file parameter list. Take note of each
parameter and its associated modbus starting register location. The sample program parameter configuration
table is based on the modbus starting address. If the correct modbus register is not indicated in the configuration
table for a given parameter then the wrong data or no data will be returned
Figure 20
page 11 of 25
Parameter Configuration Table
The Controller Tags contain the table definitions needed for configuration and display of PL1000E parameters
and Event and Diagnostic table information. Event and Diagnostic parameters will be discussed in more detail
later in this manual. Identified below is the A_Interface_Config table.
Figure 21
The PDT is the table location where all scaled data for each configured parameter is returned. The array element
number in the display table is directly associated with the same number in the configuration table array. For
example, parameter 1 is configured in array element [0], then the return value for that parameter is returned in the
same array element of the display table.
Figure 22
page 12 of 25
A_Interface_Config[n] n = 0 to 1999
Each array element of the interface configuration structure contains elements that represent information needed
by the program to retrieve parameters from the PL1000E. In our example the element A_Interface_Config[0].
StartRegister references modbus address 40001, which is associated via the PCL file with the Equipment ID
parameter.
Each parameter desired must be entered into the configuration table in the same manner as the first one.
Parameters do not need to be placed in any specific order, however any gap encountered causes the scanner to
stop processing and any parameters beyond the gap will not be scanned.
Figure 23
page 13 of 25
Basic Data Type Configuration
There are four basic data types, Signed, Unsigned, String, and Mapped. (Binary values are always treated as
unsigned)
The following figures show how each of the 3 main types are configured, the sample project does not use any of
the “mapped” data types with the exception of Events and Diagnostics which are covered in detail later in this
guide.
String Data
Length = Number of Bytes , Type = 2, ReturnVarType = 4
Figure 24
Signed Integer Data
Length = Number of Bytes , Type = 1, ReturnVarType = 0 or 1
Figure 25
Unsigned Integer Data
Length = Number of Bytes , Type = 0, ReturnVarType = 0, 1 or 2
Figure 26
page 14 of 25
A_Interface_Data[n] n = 0 to 1999
The data for each configured parameter is returned in the data window that corresponds with the data return type
desired. For example in the figure below the data is a string and may be found in the A_Interface.Data[3].String.
Any of the data types may be selected, the PLC will convert the data to the desired type.
Figure 27
page 15 of 25
Using the table format, unique parameter data can then be used in the ladder logic via creating a meaningful
named symbol and making that variable an alias of the Interface Data array.
In the sample integration project, Battery Voltage was assigned modbus register 40160 in the PCL file.
Once the modbus register and parameter details are known they can be entered into the A_Interface_Config[x]
table.
Battery Voltage
was assigned modbus register
40160 during the PCL creation
Figure 28
Figure 29
In our example, Battery Voltage at modbus register 40160, is configured using array element
A_Interface_Config[9]
Once configured the return value will always be found in the corresponding A_Interface_Data array element[9].
In order to setup the “Battery Voltage” tag, we first must enter the modbus register in the
A_Interface_Config[9].StartRegister location. This tells the program where to start looking for the data that is
associated with “Battery Voltage”.
Next, enter the length in bytes in the A_Interface_Config[9].Length. Battery Voltage is a single byte variable so the
length is 1. If Battery Voltage supports Data Status Indicators (DSI) a one would be entered next to the
Interface_Config[9].DSI_Support. Since “Battery Voltage” does not support DSI, this array element is left at zero.
Unsigned 0
Signed 1
String 2
Maped 3
Table 2
“Battery Voltage” is an unsigned variable, so a 1 is placed in the A_Interface_Config[9].Type, array element.
Finally, the slope (resolution per bit ) and offset are entered. These configuration items are very important and will
determine the accuracy of the output value Battery Voltage being translated to Modbus from CDL by the PL1000E
with a resolution of 0.5 volts per bit.
Once all of the configuration settings have been completed, select the data type needed in the return array. (See
page 9 for listing of Return Variable types). In this sample we have chosen “Float”. Battery Voltage is returned as
a floating point value accurate to 0.5 volts.(Floating Point is only data type that can store decimals)
page 16 of 25
After configuring the data parameter for visualization the A_Interface_Data[9] is accessed to display the variable
in the chosen format.
Figure 30
In the integration sample “Battery Voltage” is returned as a “FLOAT”, or floating point variable in the
A_Interface_Data[9].FLOAT array location.
Once the battery voltage data has been configured and displayed in the Interface Array, the data can be used
throughout the program.
In order to use the battery voltage parameter data in a user program in a meaningful and intuitive way, create a
program tagname “BatteryVoltage”
Figure 31
Select program tags, new tag and a window will pop up showing the properties of the new battery voltage
parameter. Type in “Battery Voltage” and a brief description of the tag. Select the Alias tagname radio button, and
using the Data_Type window browse for the controller tag, A_Interface_Data.[9].FLOAT.
Figure 32
page 17 of 25
Now each location where the Battery Voltage tagname is used we will contain the voltage data associated with
the A_Interface_Data.[9].FLOAT
Figure 33
Battery Voltage has now become an “aliased” symbol that will always reference the data found at the interface
data array.
Figure 34
This subroutine will execute when a minor fault is detected, the user can add ,logic to reset recoverable error fault
bits or write log messages. Note: This logic causes a subroutine to execute on fault detection, but does not
actually manage or handle the fault in any way. You must create your own logic and place it in the
subroutine for that purpose.
Figure 35
Detailed minor fault recovery routine information is available at the Allen Bradley website http://www.ab.com in the
support knowledgebase.
page 18 of 25
Processor Scan Rate
This subroutine will calculate the processor scan time in micro seconds and store that value in the CPU_SCAN
tagname. This value can be used to determine processing time impact of changes to the program when used a
baseline.
Figure 36
This subroutine will execute when an MVI56-MCM Fault is detected the user can add logic respond to MVI56-
MCM faults. Note: This logic causes a subroutine to execute on fault detection, but does not actually
manage or handle the fault in any way. You must create your own logic and place it in the subroutine for
that purpose.
Figure 37
page 19 of 25
MCM Data Structure Configuration and Processing.
The next 5 rungs manage the processing of the configured modbus data registers.
Starting registers that do not fall within the range of 40000 to 42000 are ignored and declared invalid resetting the
index pointer to 0. Also anytime the index pointer exceeds 2000 counts it is reset to 0.
Figure 38
If the starting register is within the acceptable range of registers, the MCM_Dataset subroutine executes.
Figure 39
page 20 of 25
The next rung increments the configuration array pointer until all of the configured parameters have been
scanned.
Figure 40
If the register is valid the Jump (JMP) instruction executes allowing the next register to load, otherwise the
Data_Invalid latch is reset and the pointer index cycle stops.
Figure 41
page 21 of 25
Events and Diagnostic Tables
The next two rungs determine if Events and Diagnostics have been configured and executes the Event and
Diagnostic subroutine. There must be a valid modbus starting register address in the “Limit Test” for this
instruction to operate. Any value outside the range of 40001 to 42000 is ignored and no diagnostic or event
information is collected.
Figure 42
Event and Diagnostic information is collected and loaded into pre-configured dataset arrays similar to the way
parameters are configured and read. The Event and Diagnostic configuration consists of matching the appropriate
starting register to the right data table. The event and diagnostic starting registers may be readily determined
using the parameter control list.
Figure 43
page 22 of 25
Event Table
The Starting Register must be entered in the table at the array element A_Event_Table.Start_Register.
The Active Events parameter must be selected in the Parameter Control List file (PCL). A modbus register must
be assigned. The same Modbus register must be entered in the array element A_Event_Table.Start_Register in
order for the event table to function properly. The events data will be collected for display in the A_Event_Table
array shown below.
A_Event_Table.Code is a paired array element that has two sub headings, A_Event_Table.Code[0].EID, and
A_Event_Table.Code[0].WCI.
Figure 44
page 23 of 25
Diagnostic Table
The Starting Register must be entered in the table at the array element A_Diagnostic_Table.Start_Register.
The Active Diagnostic parameter must be selected in the Parameter Control List file (PCL) A modbus register
must be assigned. The same Modbus register must be entered in the array element entered in the array element
A_Diagnostic_Table.Start_Register in order for the event table to function properly. The events data will be
collected for display in the A_Diagnostic_Table array shown below.
A_Diagnostic_Table.Code is a paired array element that has two sub headings, A_Diagnostic_Table.Code[0].CID,
and A_Diagnostic_Table.Code[0].WCI_FMI.
Figure 45
page 24 of 25
PL1000E Status Table
The PLC Status Table polls the Internal diagnostic registers as described in the “Systems Operations Testing and
Adjusting Guide for the PL1000E ECM RENR8091” at page 97.
The Internal diagnostic Register Address configuration is referred to as the “Data Link Address” in the service tool
and this address must match the address the MCM module polls for internal data. This example uses address
100 as the Data Link Address.
Figure 46
page 25 of 25