infoPLC Net Amdc2000modbusmaster0616
infoPLC Net Amdc2000modbusmaster0616
Release
Issued by DEN Author Marcel Dorti June , 2016
Date
MODBUS Master and Slave (Peer-to-Peer) with C2000 Built-in PLC
Title
Delta C2000/CP2000
ISPsoft
IFD6530 (C2000 communication plug)
RJ45 Ethernet cable for Laptop drive/Keypad connection.
Connecting cables for the (CAT 5) with RJ 45 connectors with RS 485 pinout to connect
Master drive to Slave drives
TPEditor to create a screen on KPC-CC01 text panel (optional)
Test setup
N/A
1
CONTENTS:
2
1 In troduction
MODBUS RTU is a layer 2 network protocol created in the end of the 70’s having in mind
the necessity of a fieldbus protocol in industry to transmit and receive data in a simple way
through the many devices of a network. MODBUS RTU uses RS-485 electrical standards
and works on a Master-Slave setup, where a master writes and reads data into the registers
of the slaves in the network. It has become default protocol in many industry devices like
PLCs, drives, sensors and it is highly used nowadays.
Delta C2000 also uses MODBUS RTU as a built-in communication protocol. In this
application note we are going to learn how to set up a Master – slave configuration, write,
read and program the internal PLC with ISPsoft to work on a peer-to-peer (P2P) application
with 2 motors, one used as a master and other as a slave. P2P is used when we want both
motors to run at the same speed together in an application and monitor their current, its
typical use can be applied to pumps, fans, conveyors, rollers. It can be also taken as an
alternative for the analog input/output of the drive, when we need more than just 2
measurements. Delta C2000 also permits to create a small Text panel customized display
with TPEditor, which we will follow at the end of the chapters.
3
2 Connecting Hardware
Delta C2000 already comes with MODBUS RTU on two RJ45 sockets which are hard-wired, just
connect the cable in any of the sockets and then if you have more slaves go on with parallel
connection, any of them can be a Master.
Figure 3 - Basic fieldbus diagram, you can have other slaves on the network, ours has only 2 drives
4
3 Parameters in Master an d Slave
There are two ways to connect the Master, one using the C2000 RJ45 socket and the other using
the signal terminals for RS 485.
Figure 4 - Pinout diagram of RS 485 ModBus, SG- and SG + are used in the cable.
Figure 5 - Connected Drives, with RJ45 socket and CAT5 cable pins 4 and 5 are used.
You can use the pinout of the terminals also in order to set another slave, like a Delta PLC for
example, 28SV. Then the pinning diagram should be like this:
5
Now we have to configure Menu 9 – Communication of the drive, and some other communication
parameters. On the master we should set the parameters according to the table below:
The drives should be the tuned for the motors being used, this tutorial covers only Modbus
configuration and internal PLC setting. Then, the Slave drive should be set with the following
configuration:
Unfortunately there’s no way to test if the communication is being done until the time you send data
to the registers of the slave, and this is the next step. Open ISPsoft, PLC programming tool for
Delta C2000 / CP2000 internal PLC and also SV2 PLCs. Go to www.delta-emea.com -> Industrial
Automation -> Download center, select like the table below, submit and download ISPsoft and
COMMGR.
There are 2 programs in ISPsoft included with this Application Note, you can use them as a
reference, however we are going to cover what is being programmed there. We will start with the
program from the Master. Basically, a P2P programming solution can be divided into those main
lines:
Set a setpoint of frequency in the master
Write it on the slave
Read current and speed of the slave
Insert them into a register in the master
Compare (optional)
Display on Text Panel information.
Set your connection with a IFD6530 to the laptop where ISPsoft was installed, install COMMMGR,
run in in Administrator mode and set your configuration.
Figure 8 - Connection to the laptop to the text panel plug, since the other will be used by Modbus
7
Figure 9 - Create a connection in COMMMGR, click on Add and Set parameters like in the picture COM3 (or any other
assigned) RTU 8 E 1 19200 bps or Click on Auto-detect on the drive internal PLC (2) to find the best speed.
8
Figure 12 - Click on System Information, if the on-line led blinks and you can get the PLC information, your communication
to the internal PLC is established
Now open a new project and a new program routine, insert a name:
9
Figure 15 - 1 - Online simulation, 2 - Compile program, 3 - Download program, 4 - Upload program, 5 - Check program, 6 - Stop Program,
7 - RUN program, 8 - Application Blocks
This program is an example for the master, you should do the same for the slave, and have one
program for each, Modbus master and slaves.
On this example let’s proceed an example with the Master, so on the example program, you will
find the ladder programming on the picture below, when X0 is closed we move 3000 (30Hz) to
register D25, when X0 is open we move 1500 (15Hz) to D25. It is a speed selector. When X1 is
closed, the FREQ block sets 100 (1s) acceleration [S1] ramp time and 100 (1s) to [S2] and the
value of D25 as a speed setpoint, then we turn M1040 to turn the drive ON and M1025 to enable it.
10
Now, open a new project again, this time for the slave drive, Modbus slave and insert a simpler
program, since the slave just receives data, and assigns data to be read. Open a new project and
program for the slave drive, connect to it like you did in the Master and insert the following
programming:
On this program, when X3 is close the block [> comparison] will compare D45 to 0, if the value is
higher than 0, it will enable the slave drive, with the setpoint value of D45 register and it will power
on the drive and also enable it. Network 2, when M1000 (which is closed, while the PLC is in RUN
mode), the RPR block will read internal parameters of the drive, and then transfer them to D
registers. The parameters are inserted in hexadecimal, they can be found in the C/CP2000 manual
on Addresses list. 16#2104 is current, 16#2103 is speed and 16#210B is torque, they will be moved
to D42, D43 and D44 sequentially. D45 is the register in which the Modbus master will write data,
and D42. D43 and D44 are registers which will be read by the master Modbus.
11
5 Ass igning data write/read with MODRW block
Now let’s learn about the functions of MODRW block, go to API / FB selection in ISPSoft and check
the MODRW block:
Take a look the Modbus instruction of the program in the master, it writes information on D45
register of the slave.
12
To write in the register of the slave, you will need a conversion table, like the one above, the
addresses in the D memory region of the internal PLC, must be converted to the slave PLC Modbus
addresses.
It is easier if you select the destination register on the slave first, for example: D45 is located in one
the lines below in yellow, the equivalent for D000 – D256 is in Modbus address 404097~404352. So,
we take 4097 which is D000 in this “scale”. We should add 4097 + 45 (-1) = 4141 dec, convert it into hex =
102D, so 16#102D, and that is the address we should assign in the master, for D45 to carry this value in the
slave.
Now, that we have the conversion table, we can convert any register in the slaves to Modbus
addresses in the master. This way every data that is inserted in those registers in the slave, can be
read out by a Master. Now we can read other addresses. Let’s use the MODRW block now, to read
information instead of writing.
S1 = slave 4
S2 = function code: 0003h = read
S3 = address in the Master (Can you calculate which
register?)
S = D26, where the information will be stored in the master
N = quantity of words: 3, so D26, 27 and 28.
MODRW will read the data of 16#102A. 102B, 102C and put into registers D26, D27 and D28.
14
Figure 19 - Modbus Master reading data from the slave
So, now we learned how to read and write data on the registers using a conversion table to find their
Modbus address, you can try your own readings now. But In a short time you will realize that you
cannot read/write at the same time, so this read and write operation must be set by time. So you
can acquire and read data inside a PLC cycle to satisfy the application.
Modbus tales some time to read and write, depending on the size of your PLC cycle. They can be
used for P2P in application where synchronization is not an issue, for example, conveyors. If you
need constant cyclic synchronization you can use other cyclic protocols like CANopen or Profibus-
DP.
On the next steps let’s see how we can program the internal PLC in order to do this read / write
procedure in a timely way.
15
Figure 20 - Programming a continuous Modbus cycle - Write
Once MI2, X3 is triggered M12 coil will be set, then M12 will enable the MODRW block, and start
counting a timer (100) 0,1s. When this time is up, T11 is closed, resetting M12 and setting the next
instruction on M13, which executes the block, saves the values, and resets M13 and M12 again, so
it will be read again on the next cycle.
16
The Modbus part of the program is over, the rest of the program is just comparison of values to be
shown on the C2000 Text panel. As we can see below, M1000 which is closed why the program is
in RUN reads the value of 16#2101 (current of the master) and moves it to D29, the next instruction
subtracts D25 and D27 and put the value in D30. (To compare Master and slave speeds), and so
does the other D29 subtracts D26 (master current and slave current read from MODRW) and moves
the result to D31 in order to compare them. The P2P program is ready.
Figure 23 - Divide the values by 100 so they can be displayed correctly, since they are acquired with x 10^2
17
6 T PEditor
Delta C/CP2000 text panel the KPC-CC01 permits you to display information from the internal PLC
of the drive in a totally customized interface. You can download TPEditor in www.delta-emea.com ->
Industrial Automation -> Download center. Text Panel products.
Download the TPEditor example and open it, you will see a screen like this, you are free to create
your own, but you should use this first one as an example.
Figure 25 - 1 - Build all screens to be uploaded, 2 - Upload from display, 3 - Plain Text on display, 4 - Numeric display
(associated to a value in PLC), 5 - Button for next screen, 6 - bargraph which contains a value from PLC
18
Figure 26: 1 - Bargraph, 2 - Bargraph menu, 3 - Variable in PLC (Register),
19
Figure 28 - 1 - Create a small button to assign functions to the function keys on the keypad, 2 - Define a function key,
Now, connect you Ethernet cable to the RJ45 socket of the KPC-CC01 and to the IFD530 to your
computer’s USB port, on the display go to 13 – PC link, TPEditor. On TPEditor, click on Build all
and then Write to TP.
20
Figure 30 - Uploading the TPEditor program file into the KPC-CC01
Now, go to Menu 12: Main Page, set it to User defined, and to Menu 11: Start-up: set it to User
Defined. Now you will be able to test your variables on the Text Display.
Important Note: Even though there are many options in the Library for TPEditor, the keypad
KPC-CC01 does not accept many objects available in TPEditor’s library. Use the standard
ones of this example and everything will be fine.
21
7 Basic rotational equations for linear and rota ry motion
a = acceleration [m/s2]
v = speed [m/s]
s = space [m]
r = radius [m]
= angle [degrees]
= angular speed [rad/s]
= angular acceleration [rad/s2]
= [ ] - Angular acceleration
= ∙ = ∙ ∙ [ ⁄ ] – Linear speed
= = ∙ [ ] – Angular speed
= ∙ [ ] – Accelerating Force
= ∙ = ∙ ∙ [ ] – Accelerating torque
= ∙ = ∙ = ∙ ∙ [ ] – Accelerating power
22
Converting linear masses into moment of inertia:
1 1
∙ = ∙ ∙ → = ∙( )
2 2
Now, you can use the same equation of angular motion with the equivalent Moment of inertia of the
linear loads. Those equations might be useful in order to better calculate a motor and a drive for a
conveyor belt.
23