Redlion MP2300Siec Modbus Configuration v004

15
Doc#: AN.MCD.08.122 Copyright Yaskawa Electric America ©2008 October 22, 2008 Page 1 of 10 Technical Note and Sample Code QuickStart Guide Configuring a RedLion HMI to communicate to an MP2000Siec Controller via MODBUS/TCP Applicable Product: MP2000Siec, RedLion G310 HMI

Transcript of Redlion MP2300Siec Modbus Configuration v004

Page 1: Redlion MP2300Siec Modbus Configuration v004

Doc#: AN.MCD.08.122 Copyright Yaskawa Electric America ©2008 October 22, 2008 Page 1 of 10

Technical Note and Sample Code

QuickStart Guide

Configuring a RedLion HMI to communicate to an

MP2000Siec Controller via MODBUS/TCP

Applicable Product: MP2000Siec, RedLion G310 HMI

Page 2: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 2 of 15

Table of Contents

1. Application Overview:.......................................................................................................... 3 Products Used:..................................................................................................................... 4

2. Configuration Procedure ..................................................................................................... 4 3. HMI Sample code................................................................................................................ 8 4. MotionWorks IEC Program Explanation............................................................................ 12 5. Program Control Handles.................................................................................................. 15 6. Operation sequence.......................................................................................................... 15 7. Program attachments........................................................................................................ 15

Page 3: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 3 of 15

1. Application Overview:

This document is intended to guide a user through the steps of configuring a RedLion HMI as a MODBUS master communicating with the MP2000Siec controller as a slave. This application note was created with a G310 series HMI with Crimson 2.0 software. The MP2000Siec controller has firmware version 1.0.0.1 and MotionWorks IEC Express software version 1.0.0.1. The sample HMI application sends jog commands to the controller and reads axis status, velocity, position and torque.

Figure1: Overview of test set up

Page 4: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 4 of 15

Products Used:

Controller

Hardware

Software MotionWorksIEC, Crimson 2.0

Sigma series servopack and motor, RedLion G310 HMI, Ethernet switch

Yaskawa MP2300Siec controller

2. Configuration Procedure

I. Set the IP addresses of the devices (HMI, controller, PC with programs). In the test set up, the IP

addresses were: Controller: 192.168.1.1, HMI: 192.168.1.2, PC: 192.168.1.3

To set the IP address of the controller, turn the E-Init DIP switch to the ON position. The default IP

address on the MP2000Siec controller is 192.168.1.1 unless changed by a user.

Figure 2: Set IP address of controller

II. To set the IP address of the RedLion G310: On the opening page of Crimson 2.0, double click on the

communications tab.

Page 5: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 5 of 15

Fugure3: To set the HMI IP address

Double click on Ethernet and set the IP address of the HMI as shown in Figure 4.

Figure 4: HMI IP address

Click on Protocol 1. Edit the driver selection to select MODBUS as manufacturer and TCP/IP master

as driver. No special Yaskawa driver is necessary.

Page 6: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 6 of 15

Figure 5: Communication Protocol

This will create the slave configuration under protocol 1. When double clicking on the slave device

created, the IP address of the slave in this communication process can be specified. (Figure 6).

Figure 6: IP address of slave specified

III. Using an HMI (Master) to communicate to the controller using Modbus TCP

Page 7: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 7 of 15

In MotionWorks IEC, the New Project template includes global I/O groups and drivers to allow the

controller to respond to incoming Modbus messages. Figure 7 shows the Modbus memory map, and

how it relates to the Global Variables in MotionWorks IEC. Note that function codes 01 and 03 return

data that was sent to the controller from the master and do not reflect data from the Global Variables in

the application program.

The Modbus data memory is copied to the Global Variables at the task update rate.

Modbus coil 0 equates to the Global Variable at %IX1152. 128 coils are available.

Modbus register 40000 equates to the Global Variable at %IW1168. 1024 registers are available.

Modbus input 10000 equates to the Global Variable at %QX1152. 128 inputs are available.

Modbus register 30000 equates to the Global Variable at %QW1168. 1024 registers are available.

As shown in Figure 7 below, the input and output memory is in a different location even though they

have the same numerical addressing.

Figure 7: MODBUS mapping

Page 8: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 8 of 15

IV. The “New Project” template will automatically create communication drivers and allocate global memory

for external devices to read & write information in the controller. These memory areas are generic: no

variables are automatically created, the user can decide on the arrangement and type of data to

populate within the communications memory region. If the MP2000iec controller is the slave, no set

up is required in the controller. The user can add variables as required in each group used for

communication.

Figure 8: Variable groups created in template

A word coming from the HMI will be mapped from register 40001 in the RedLion to %IB1168. The user

should verify the data type used for data transfer. Examples are provided and explained in the sample

program given later in this document. Bits written from the HMI to the controller are mapped from

00001 to %IX1152.0. Outputs from the controller are mapped from %QB1168 ->300001

and %QX1152.0 -> 10001

3. HMI Sample code

The sample application attached with this document is intended to implement a jog operation. The HMI panel interface is intended to provide a window for the following user inputs: 1. Servo Enable (bit) 2. Forward direction 3. Reverse direction 4. Jog Speed 5. Jog acceleration 6. Jog deceleration

Page 9: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 9 of 15

The following outputs from the controller also will be displayed at the HMI interface: 1. ServoStatus 2. InVelocity 3. Actual Position 4. Actual Velocity 5. Actual Torque The variable tags have been defined in the data tags tab in the RedLion project.

Figure 9: Data tags

When creating a new tag, the user can specify the data type of the tag. The user can also map the tag

and specify what register location that tag should be associated with. For example, the tag

‘ServoEnable’ is mapped to a location in PLC1, which is the slave IEC controller. On clicking the edit

button, the register and data type can be seen as shown in Figure 10. It can be seen that a bit was

chosen as the data type. The register to which that tag is mapped is 00001 and it is a coil. This bit will

be mapped to the first bit mapped under Function Code (FC) 5. The access to this tag is set as ‘Write

Only’ as this variable is used for writing to the controller. FWD and REV are similar bit tags. The ‘Jog

speed’ tag mapping is shown in Figure 11. A ‘word swap’ transformation is carried out for words. The

register used for the word is 40001. Figure 12 illustrates the mapping of a tag that is a read access

variable that reads the servo status from the controller to display at the HMI panel. Figure 13 illustrates

a controller output real variable displayed at the HMI.

Page 10: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 10 of 15

Figure 10: Mapping bit (FC: 5)

Figure 11: Mapping word (FC: 16)

Page 11: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 11 of 15

Figure 12: Bit Mapping (FC: 2)

Figure 12: Word mapping (FC: 4)

Page 12: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 12 of 15

The user interface on the HMI screen is as shown in Figure 13.

Figure 13: HMI user interface screen shot

4. MotionWorks IEC Program Explanation

The program provided with this application note uses a user defined library of function blocks that include servo enable, jog and monitor function blocks. This is not required for communication in general. In order to incorporate this user defined library, the user will have to add the user defined library. This can be done by right clicking on ‘Libraries’ and inserting user library. The user library inserted in this case is “PLCopen Toolbox v002.mwe’ (Figure 14). Once this library has been inserted and the program compiled, the FBs in the main POU will be active and will appear as shown in Figure 15. If the FBs are yellow in color, the user library has not been incorporated in the project.

Page 13: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 13 of 15

Figure 14: Inserting user defined library

Figure 15: EnableServo1-User defined FB, REAL_TO_LREAL – Standard FB

Page 14: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 14 of 15

Figure 16: Variables in the MP2300 SIIEC controller (Slave) The global variable list with the MODBUS variables being used is shown in detail in Figure 16. The last two groups corresponding to function codes 05 and 16 are the input variables written from the HMI to the controller. The groups under function codes 02 and 04 are used to transfer variables from the controller to the HMI. They are denoted by %QX and %QB. Table 1 shows the variable mapping in this sample project.

Table 1: variable mapping FC#05: From master to slave (coils) EnableServo %IX1152.0 00001 ServoEnable GoForward %IX1152.1 00002 FWD GoReverse %IX1152.2 00003 REV FC#16: From master to slave (registers) Speed %ID1168 400001 JogSpeed Accel %ID1172 400003 JogAccel Decel %ID1178 400005 JogDecel FC#02: From slave to master (Inputs) ServoPowerStatus %QX1152.0 100001 ServoStatus AxisInVelocity %QX1152.1 100002 InVelocity FC#04: From slave to master (Registers) ActualPosition %QD1168 300001 AxisPosition ActualVelocity %QD1172 300003 AxisVelocity ActualTorque %QD1176 300005 AxisTorque

Page 15: Redlion MP2300Siec Modbus Configuration v004

Subject: Tech Note and Sample Code Product: MP2000Siec Doc#: AN.MCD.08.122

Title: Quickstart guide to configure RedLion HMI and MP2000Siec controller communication via MODBUS

October 22, 2008 Page 15 of 15

5. Program Control Handles

1) To load the program to the RedLion HMI, go to the ‘link’ tab and update and send the

‘Jogging_2008_0524’ file to the HMI. Once the program is loaded on the HMI, the user interface will be

displayed on the screen.

2) Open the ‘RedLion_Jogging.mwe’ program and insert the user library project ‘PLCopen Toolbox

v002.mwe’. Compile, Download, Warm Start, and set MotionWorks IEC in debug mode.

Figure 17: Compile, debug and download

3) The projects is ready for use.

6. Operation sequence

When turning on the ‘ServoEnable’ switch, Axis 1 turns on (if there are no errors on the axis). Set the speed, accel and decel for the axis to jog. If one wants the axis to go forward, turn on the FWD switch. To go reverse, turn on the REV switch. The servo status can be seen on the output window. The InVelocity bit turns on when the axis is jogging at the specified velocity. The actual position, velocity and torque can be monitored in real time through the output window.

7. Program attachments