Sie sind auf Seite 1von 24

Application Example

AC500
Scalable PLC
for Individual Automation
Modbus RTU Communication
AC500 CPU - UMC

Content
1

Disclaimer ..................................................................................................................3
1.1 For customers domiciled outside Germany/
Fr Kunden mit Sitz auerhalb Deutschlands........................................................................ 3
1.2

Nur fr Kunden mit Sitz in Deutschland ........................................................................ 3

AC500 PM554 eCo CPU communication over Modbus RTU with UMC ................4
2.1

AC500 CPUs .................................................................................................................... 4

2.2

AC500 Modbus RTU line ................................................................................................. 4

2.3

Hardware configuration .................................................................................................. 5

PLC program..............................................................................................................6
3.1

PS502 Configurator......................................................................................................... 6

3.2

eCo CPU........................................................................................................................... 6

3.3

rtsinfo............................................................................................................................... 7

3.4

Configuration of the serial port ...................................................................................... 7

3.5

IP settings ........................................................................................................................ 8

PLC_PRG ...................................................................................................................9
4.1

Modbus RTU library and program.................................................................................. 9

4.2

POUs ................................................................................................................................ 9

4.3

COM_MOD_MAST instance .......................................................................................... 10

4.4

POUs .............................................................................................................................. 10

4.4.1

Read binary inputs................................................................................................. 11

4.4.2

Read analog inputs................................................................................................ 13

4.4.3

Read diagnosis ...................................................................................................... 14

4.4.4

Start/stop UMC ...................................................................................................... 15

Using a serial analyser............................................................................................18


5.1

Modbus data exchange................................................................................................. 19

Application Example

-1-

AC500/Issue: 09.2011

Related documents .................................................................................................20


6.1

UMC100-FBP technical description ............................................................................. 20

6.2

Modbus RTU FieldbusPlug MRP21-FBP technical description.................................. 20

6.3

AC500 Control Builder .................................................................................................. 21

6.4

AC500 CPU .................................................................................................................... 21

6.5

Modbus protocol description ....................................................................................... 21

Application Example

-2-

AC500/Issue: 09.2011

1 Disclaimer
1.1 For customers domiciled outside Germany/
Fr Kunden mit Sitz auerhalb Deutschlands
"Warranty, Liability:
The user shall be solely responsible for the use of this application example described within this file.
ABB shall be under no warranty whatsoever. ABB's liability in connection with this application example or the
files included within this file, irrespective of the legal ground, shall be excluded. The exclusion of liability shall
not apply in the case of intention or gross negligence. The present declaration shall be governed by and
construed in accordance with the laws of Switzerland under exclusion of its conflict of laws rules and of the
Vienna Convention on the International Sale of Goods (CISG)."
"Gewhrleistung und Haftung:
Der Nutzer ist allein fr die Verwendung des in dieser Datei beschriebenen Anwendungsbeispiels
verantwortlich.
ABB unterliegt keiner Gewhrleistung. Die Haftung von ABB im Zusammenhang mit diesem
Anwendungsbeispiel oder den in dieser Datei enthaltenen Dateien - gleich aus welchem Rechtsgrund - ist
ausgeschlossen. Dieser Ausschlu gilt nicht im Falle von Vorsatz oder grober Fahrlssigkeit. Diese
Erklrung unterliegt Schweizer Recht unter Ausschlu der Verweisungsnormen und des UN-Kaufrechts
(CISG)."

1.2 Nur fr Kunden mit Sitz in Deutschland


"Gewhrleistung und Haftung:
Die in diesem Anwendungsbeispiel enthaltenen Dateien beschreiben eine mgliche Anwendung der
Steuerung AC500 bzw. zeigen eine mgliche Einsatzart der Steuerung. Sie stellen nur Beispiele fr
Programmierungen dar, sind aber keine fertigen Lsungen. Eine Gewhr kann nicht bernommen werden.
Der Nutzer ist fr die ordnungsgeme, insbesondere vollstndige und fehlerfreie Programmierung der
Steuerungen selbst verantwortlich. Im Falle der teilweisen oder ganzen bernahme der
Programmierbeispiele knnen gegen ABB keine Ansprche geltend gemacht werden.
Die Haftung von ABB, gleich aus welchem Rechtsgrund, im Zusammenhang mit den Anwendungsbeispielen
oder den in dieser Datei enthaltenen Dateien wird ausgeschlossen. Der Haftungsausschlu gilt jedoch nicht
in Fllen des Vorsatzes, der groben Fahrlssigkeit, bei Ansprchen nach dem Produkthaftungsgesetz, im
Falle der Verletzung des Lebens, des Krpers oder der Gesundheit oder bei schuldhafter Verletzung einer
wesentlichen Vertragspflicht. Im Falle der Verletzung einer wesentlichen Vertragspflicht ist die Haftung
jedoch auf den vertragstypischen, vorhersehbaren Schaden begrenzt, soweit nicht zugleich ein anderer der
in Satz 2 dieses Unterabsatzes erwhnten Flle gegeben ist. Eine nderung der Beweislast zum Nachteil
des Nutzers ist hiermit nicht verbunden.
Es gilt materielles deutsches Recht unter Ausschlu des UN-Kaufrechts."

Application Example

-3-

AC500/Issue: 09.2011

2 AC500 PM554 eCo CPU communication over Modbus


RTU with UMC

2.1 AC500 CPUs


The CPUs from the AC500 PLC family are equipped with one or two serial interfaces.
The Modus RTU protocol is always implemented in the firmware of the CPU, the corresponding Modbus
RTU libraries are free.
Therefore is possible to build two RS 485 lines, in order to communicate over Modbus RTU with max. 31
UMCs on each line. In real configurations the total scan time for a line will limit this number to 8-16 UMCs.
The AC500 CPU is Modbus RTU master and will exchange data with the UMCs, acting as modbus slaves.
The Modbus RTU communication is based on the master slave princip: the ,master is generating standard
modbus request telegram, the corresponding slave unit will answer with a standard reply telegram.

2.2 AC500 Modbus RTU line

The data exchange with an external supervisor system can be done using different communication
protocols( Modbus TCP/IP, Profibus, etc.).

Application Example

-4-

AC500/Issue: 09.2011

2.3 Hardware configuration


In the following example we will take an AC500 eCo CPU/PM554 and one UMC100 with Modbus RTU FBP.
The communication will be done over an RS 485 line with the parameters 19200,8,1,even.

AC500 eCo CPU


PM554 CPU
Modbus RTU master

UMC 100

RS 485, 19200, 8,1, E


request

blue
120 Ohm

3
COM 1

Modbus RTU slave


MRP21

reply

white

5
SUB-D, 9 pin, male

UMC.project

AC500 PM 582 CPU modbus RTU master UMC 100 with MRP21 FBP

Application Example

-5-

AC500/Issue: 09.2011

3 PLC program

3.1 PS502 Configurator


The PLC program was written with the ABB Configurator PS502 V2.0.0

3.2 eCo CPU


using the eCo CPU PM554-ETH V2.0

Application Example

-6-

AC500/Issue: 09.2011

3.3 rtsinfo

3.4 Configuration of the serial port


The CPU use for the modbus RTU communication the serial port COM1, with the parameters 19200 baud,
RS485 (RTS control = Telegram ), 8 data bits, 1 stop bit, even parity ( default values for the SACE CBs ), as
modbus RTU master.

Application Example

-7-

AC500/Issue: 09.2011

3.5 IP settings
The programing and online acces to the CPU will be done over the ethernet port, in this case the CPU is
already configured, with the IP address 192.168.5.47, subnet mask 255.255.248.0.

PC IP Settings
The PC has to be in the same network as the CPU.

Application Example

-8-

AC500/Issue: 09.2011

4 PLC_PRG
The PLC program is given in this example as text and could be written with the actual version of the AC500
configurator.

4.1 Modbus RTU library and program


The program will be written with the AC500 Control Builder ( start

4.2 POUs
Two POUs are created: PLC_PRG(PRG) and RUN(PRG).

In the PLC_PRG POU the instance of the COM_MOD_MAST Modbus RTU function block is called.
The parameter for the different Modbus data communication ( read/write registers in slave ) and the data
handling are handled in the POU named RUN, written in structure text.

Application Example

-9-

AC500/Issue: 09.2011

4.3 COM_MOD_MAST instance

4.4 Step chain


The instance of the modbus function block will be parametrized from the RUN(PRG) program written in ST.
POU for the step chain ( RUN )

Application Example

- 10 -

AC500/Issue: 09.2011

4.4.1 Read binary inputs

CASE CHAIN OF
(*read binary inputs*)
0: (*send request read binary inputs*)
IF NOT UMC.DONE THEN
IF NOT (start_UMC OR stop_UMC) THEN
UMC.EN:=TRUE;
UMC.COM:=1;
UMC.SLAVE:=47;
UMC.FCT:=1;
UMC.TIMEOUT:=1000;
UMC.ADDR:=16#0;
UMC.NB:=16;
CHAIN:=100;
ELSE
CHAIN:=1000;
END_IF
END_IF
100: (*reply read binary inputs arrived*)
IF UMC.DONE THEN
UMC.EN:=FALSE;
binary_in_value:=binary_inputs;
CHAIN:=200;
END_IF

Application Example

- 11 -

AC500/Issue: 09.2011

Application Example

- 12 -

AC500/Issue: 09.2011

4.4.2 Read analog inputs


This is an example for reading 7 words.

Example to read one analog input.


(*read analog inputs*)
200: (*send request read analog inputs*)
IF NOT UMC.DONE THEN
UMC.EN:=TRUE;
UMC.COM:=1;
UMC.SLAVE:=47;
UMC.FCT:=3;
UMC.TIMEOUT:=1000;
UMC.ADDR:=16#0200;
UMC.NB:=1;
CHAIN:=300;
END_IF
300: (*reply read analog inputs arrived*)

IF UMC.DONE THEN
UMC.EN:=FALSE;
analog_in_value:=analog_inputs;
CHAIN:=400;
END_IF

Application Example

- 13 -

AC500/Issue: 09.2011

4.4.3 Read diagnosis

400: (*send request read diagnosis *)


IF NOT UMC.DONE THEN
UMC.EN:=TRUE;
UMC.COM:=1;
UMC.SLAVE:=47;
UMC.FCT:=3;
UMC.TIMEOUT:=1000;
UMC.ADDR:=16#2000;
UMC.NB:=2;
CHAIN:=500;
END_IF
500: (*reply read diagnosis arrived*)
IF UMC.DONE THEN
UMC.EN:=FALSE;
diagnosis_value:=diagnosis;
CHAIN:=0;
END_IF

Application Example

- 14 -

AC500/Issue: 09.2011

4.4.4 Start/stop UMC

(*start_UMC OR stop_UMC*)
1000: (*send request for start or stop UMC*)
IF NOT UMC.DONE THEN
UMC.EN:=TRUE;
UMC.COM:=1;
UMC.SLAVE:=47;
UMC.FCT:=15;
UMC.TIMEOUT:=1000;
UMC.ADDR:=16#0100;
UMC.NB:=16;
CHAIN:=1100;
IF start_UMC THEN
start:=16#2400; (*value for start* UMC)
END_IF

Application Example

- 15 -

AC500/Issue: 09.2011

IF stop_UMC THEN
start:=16#2200; (*value for stop UMC*)
END_IF
END_IF
1100: (*reply for start or stop UMC has arrived*)
IF UMC.DONE THEN
UMC.EN:=FALSE;
CHAIN:=1200;
END_IF
Continue with read
(*(wait until start_UMC OR stop_UMC=FALSE*)
1200:
IF NOT (start_UMC OR stop_UMC) THEN
CHAIN:=0;
END_IF

END_CASE
Start/Stop UMC inputs

Application Example

- 16 -

AC500/Issue: 09.2011

Global variables

Application Example

- 17 -

AC500/Issue: 09.2011

5 Using a serial analyser


In some cases the exact structure of the request/reply telegrams could help in order to analyse the data
exchange between the modbus master ( AC500 CPU ) and the modbus slaves ( SACE CBs, UMC, operator
panels ).
The software Docklight can be installed on a Window PC.
We have obtained good results with the USB to RS485 converter USB Nano 485.

AC500 eCo CPU


PM554 CPU
Modbus RTU master

UMC 100

RS 485, 19200, 8,1, E


request

COM 1
8

blue
120 Ohm

Modbus RTU slave


MRP21

reply

white

SUB-D, 9 pin, male

B
RS 485

UMC. project

USB Nano 485


www.cti-lean.com
USB
Docklight Software

PC with W in XP Pro

AC500 PM 582 CPU modbus RTU master UMC 100 w ith MRP21 FBP with PC telegram analyser Docklight

Application Example

- 18 -

AC500/Issue: 09.2011

5.1 Modbus data exchange

Application Example

- 19 -

AC500/Issue: 09.2011

6 Related Documents

6.1 UMC100-FBP technical description

6.2 Modbus RTU FieldbusPlug MRP21-FBP technical


description

Application Example

- 20 -

AC500/Issue: 09.2011

6.3 AC500 Control Builder

6.4 AC500 CPU

6.5 Modbus protocol description

Application Example

- 21 -

AC500/Issue: 09.2011

Application Example

- 22 -

AC500/Issue: 09.2011

No. o. p.:

Helpline document

23

Title:

Lang.:

Modbus RTU Communication AC500 CPU - UMC

EN

Manual No. 2CDC 125 161 M0201

Doc. kind:

ABB Automation Products GmbH


Wallstadter Str. 59
D-68526 Ladenburg
Tel. : +49 62 21 / 701-1444
Fax : +49 62 21 / 701-1382
E-Mail : plc.support@de.abb.com
www.abb.com/plc