0% found this document useful (0 votes)
1K views

AC500 - V3 - Modbus - RTU - TCP With Third Party Devices

ABB

Uploaded by

Soumya Sagar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

AC500 - V3 - Modbus - RTU - TCP With Third Party Devices

ABB

Uploaded by

Soumya Sagar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

2024

AC500 V3
TRAINING & WEBINARS
Vasanth Kumar N, Vidya G S

Product Training & Support Team

Vasanth Kumar N
Vidya G.S
Product Training & Support
Product Training & Support
Motion - Drives Product
Motion - Drives Product
[email protected]
[email protected]

[email protected]

February 1, 2024 Slide 2



Training and Webinar Calendar – 2024
MODP – PLC, HMI AND ZENON SCADA

February 1, 2024 Slide 3 AC500 V3



JAN 2024

AC500 V3
Modbus RTU & TCP/IP communication with multiple third-party devices
Vasanth Kumar, Vidya G S

AGENDA

• Modbus RTU – International standard bus


• AC500 V3 and Modbus RTU
• Configuring Modbus RTU on serial interface
• Modbus RTU library
• Modbus TCP – International standard bus
• AC500 V3 and Modbus TCP
• Configuration and parameterization of Modbus TCP/IP
• Modbus TCP/IP library
• Demo

February 1, 2024 Slide 5 AC500 V3



Modbus RTU – International standard bus
Comparison- Modbus RTU & Modbus TCP/IP

Serial based Ethernet based


Physical Medium
• RS232 – Point to Point
(Network) • LAN(Cable)
• RS485 – Multipoint
Protocol • Modbus TCP/IP
• Modbus RTU

• Less susceptible to noise


• More susceptible to noise
• Master slave configuration(1 Master
• Server client configuration
Key Differences and max. 31 slaves)
• Unlimited number of devices*
• Limited number of devices
• Wide area coverage
• Network distance limitation

February 1, 2024 Slide 6 *Not applicable for all protocols


— COM1
AC500 V3 and Modbus RTU
AC500-eCo V3 - option board for COMx serial communication

TA5142-RS485I or TA5142-RS485 Technical data

1- Termination resistance settings


2- Pull-up and pull-down settings

February 1, 2024 Slide 7 AC500 V3



AC500 V3 and Modbus RTU
AC500 V3- PM5630-2ETH, PM5650-2ETH, PM5670-2ETH,PM5675-2ETH

Serial interface COM1 COM1

February 1, 2024 Slide 8 AC500 V3



AC500 V3 and Modbus RTU

Bus Cable Cable Length

February 1, 2024 Slide 9 AC500 V3



Configuring Modbus RTU on serial interface
Enable Modbus RTU as “Modbus RTU Client”

Add object to ‘OptionSlot_1’ Add object to CAA_SerialCom Object is visible in the tree

February 1, 2024 Slide 10 AC500 V3



Configuring Modbus RTU on serial interface
Enable Modbus RTU as “Modbus RTU Server”

Add object to ‘OptionSlot_1’ Add object to CAA_SerialCom Object is visible in the tree

February 1, 2024 Slide 11 AC500 V3



Configuring Modbus RTU on serial interface
Parameters

Serial(COM_1 node) Modbus RTU server node

Select Baudrate, Parity and Stop Bits. The parameter “Data bits” “Address” Bus address of the PLC as Modbus RTU Server on that
always has to be set to “8” for Modbus. They are common for interface
both operating modes client and server.

February 1, 2024 Slide 12 AC500 V3



Function codes supported by AC500

Function code
Max. length Description
DEC HEX

01 or 02 01 or 02 2000 bits Read n bits

03 or 04 03 or 04 125 words / 62 double words Read n words

05 05 1 bit Write one bit (encoded in one word)

06 06 1 word Write one word

15 0F 2000 bits Write n bits (encoded in one byte)

16 10 123 words / 61 double words Write n words

22 16 Write: 1 word Mask write


Read: 125 words / 62 double words
23 17 Read/write multiple words in one telegram
Write: 123 words / 61 double words

February 1, 2024 Slide 13 AC500 V3



Addressable %M area: Access bit-, byte-, word-, and double-word wise
Byte order: Little endian

Example 1: Example 2:

%MX0.0 := TRUE %MX3.0 := TRUE


%MB0 := 16#01 := 1 %MB3 := 16#01 := 1
%MW.0 := 16#0001 := 1 (Bit 0) %MW1 := 16#0100 := 256 (Bit 8)
%MD0 := 16#00000001 := 1 (Bit 0) %MD0 := 16#01000000 := 16777216

Bits 31 … 24 23 … 16 15 … 8 7…0
BOOL %MX3.7- %MX3.0 %MX2.7- %MX2.0 %MX1.7- %MX1.0 %MX0.7- %MX0.0
Byte %MB3 %MB2 %MB1 %MB0
Word %MW1 %MW0
Double word %MD0

February 1, 2024 Slide 14 AC500 V3



Modbus address table: Word access
A WORD in the %M area is assigned to each Modbus address 0000hex .. FFFFhex

February 1, 2024 Slide 15 AC500 V3



Modbus address table: Bit access (1)
Bit addresses 0000hex .. FFFFhex are contained in the word range %MW0 .. %MW4095

February 1, 2024 Slide 16 AC500 V3



Modbus address table: Bit access (2)
Bit addresses 0000hex .. FFFFhex are contained in the word range %MW0 .. %MW4095

February 1, 2024 Slide 17 AC500 V3



Modbus address calculation

%M bit variable address out of a hexadecimal address Hexadecimal address out of a %M bit variable address
Calculation example: Calculation example:

Modbus bit address hexadecimal = 16#2002 Bit variable = %MX6666.2


Modbus bit address decimal = 8194
Modbus bit address decimal = 6666 * 8 + 2 = 53330
BYTE = 8194 / 8 = 1024
Modbus bit address hexadecimal = 16#D052
BIT = 8194 mod 8 = 2

Bit variable: %MX1024.2


Byte variable: %MB1024
Word variable: %MW512
Double-word variable %MD256

February 1, 2024 Slide 18 AC500 V3



Modbus RTU library

– AC500 Modbus RTU library is available with Automation Builder


– No license is required

• Function blocks to be used by implementing of a project for


CPU of type V3. The function blocks are used for:
o Configuration of Modbus parameters (client configuration)
o Communication purposes
o Diagnostics
o Server control

February 1, 2024 Slide 19 AC500 V3



Modbus RTU library
Client FB: ModRtuMast

Execute: A rising edge starts the operation


Com: Number of the assigned serial interface, 1..
Endian: Select the endianes / byte order of data formatted as
WORD
Serv: Address of the remote Modbus RTU Server device (0 =
broadcast)
Fct: Function Code as specified in Modbus Protocol
Specification
Timeout: Wait for server’s response up to Timeout milliseconds
Addr: Operand/Register address in remote Modbus RTU
server
Nb: Amount of data units to be sent or received
Data: Address of local buffer for data to be sent or received
ErrorID: Code of error occured during execution

February 1, 2024 Slide 20 AC500 V3



AGENDA

• Modbus RTU – International standard bus


• AC500 V3 and Modbus RTU
• Configuring Modbus RTU on serial interface
• Modbus RTU library
• Modbus TCP – International standard bus
• AC500 V3 and Modbus TCP
• Configuration and parameterization of Modbus TCP/IP
• Modbus TCP/IP library

February 1, 2024 Slide 21 AC500 V3



Modbus TCP – International standard bus

Basics
− Open industrial Ethernet network specified by the Modbus-IDA user organization
Modbus application in co-operation with the Internet Engineering Task Force (IETF) as an RFC
layer Internet standard
− Modbus TCP protocol is implemented on top of Ethernet-TCP/IP layers
Modbus on TCP

TCP

IP

Ethernet II/802.3.
physical layer

February 1, 2024 Slide 22 AC500 V3



Data transmission
Principle client - server

A client is always initiating the data exchange

Preconditions:
– IP addresses are set
client server server server/client
– Client and server functionality are configured
device 1 device 2 device 3 device 4

Example for 4 devices and one telegram: Firmware Firmware Firmware Firmware
1. Client’s ‘device 1’ request frame:
• ‘Data read’ from server ‘device 3’ or
Frame Filter Frame Filter Frame Filter Frame Filter
• ‘Data write’ to server ‘device 3’

2. Server’s ‘device 3’ response: A frame with: Ethernet / Modbus TCP


• Requested data or
• Positive response of receiving data or
• Error message

February 1, 2024 Slide 23 AC500 V3



Modbus TCP Communication
AC500 V3 as server and/or client

Data exchange between AC500 CPUs or AC500 and other devices


– Via one ETH port an AC500 CPU can act as:
• Client (master)
• Server (slave)
• Both: Client and server

Data exchange between AC500 CPUs and CP600 HMI


– AC500 is server. It exchanges data on client’s request.
– CP600 is the client. It initiates the communication.

February 1, 2024 Slide 24 AC500 V3



Modbus connection capability

Protocol PM5630-2ETH PM5650-2ETH PM5670-2ETH PM5675-2ETH As of CPU


FW version
Modbus TCP server 30 100 100 100 3.0.3
40 40 40 40 3.1.0
15 25 50 50 3.1.3
Modbus TCP client with POU ETHx_MOD_MAST n/a 100 n/a n/a 3.0.1
40 40 40 40 3.1.0
30 50 120 120 3.1.3

Modbus TCP client with POU ETHx_MOD_MAST 30 100 100 100 3.1.0
or ModTcpMast (PLCopen style) 30 50 120 120 3.1.3

February 1, 2024 Slide 25 AC500 V3



Sockets and ports

Protocol Port Sockets

1 socket listen + 1 socket per server connection, number


Modbus TCP server 502 or configurable
of server connections is configurable in AB

Modbus TCP client with POU


Random 1 socket per connection with POU ETHx_MOD_MAST
ETHx_MOD_MAST

Modbus TCP client with POU


1 socket per connection with POU ETHx_MOD_MAST or
ETHx_MOD_MAST or ModTcpMast Random
ModTcpMast
(PLCopen style)

February 1, 2024 Slide 26 AC500 V3



Modbus Retain Persistent variables

– Pragma attribute 'no_init' is used for a %M variable to define its behavior as RETAIN PERSISTENT
– Syntax:
{attribute 'no_init'}
– Insertion position: In the declaration part, above the declaration line of a particular variable

February 1, 2024 Slide 27 AC500 V3



Configure Modbus TCP server

Add object to ‘ETHx’ Select protocol Object is visible in the tree

February 1, 2024 Slide 28 AC500 V3



Modbus TCP server: Parameter settings

– Define byte order for Modbus data as ‘Big Endian’ (byte swapping) or ‘Little endian’ depending of required order by a counterpart
– The default port number for Modbus TCP protocol is 502. The port number can also be configured.
– You can define the behavior on start-up and in state inactive
– With ‘Disable write’ and ’Disable read’ you can protect the server data buffers from access by client

February 1, 2024 Slide 29 AC500 V3



Online status indication of TCP server in the device tree

Status ‘Active’ Status ‘Inactive’

February 1, 2024 Slide 30 AC500 V3



Configure Modbus TCP client

Add object to ‘Protocols’ Select protocol Object is visible in the tree

February 1, 2024 Slide 31 AC500 V3



AC500 Modbus TCP library

– AC500 Modbus TCP library is available with Automation Builder


– No license is required

– The library contains two types of function blocks:


• Compatible V23 – function blocks which are used by
conversion of projects implemented for CPUs of type V2 into
version for CPUs of type V3
• Function blocks to be used by implementing of a project for
CPU of type V3. The function blocks are used for:
o Configuration of Modbus parameters (client configuration)
o Communication purposes
o Diagnostics
o Server control

February 1, 2024 Slide 32 AC500 V3



Client FB: ModTcpConfig
Configuring Modbus TCP client parameters

Execute: A rising edge starts the operation


RespTimeout: Server response timeout in milliseconds. Maximum
time waiting for a response after having sent a
request
KeepAlive: Open Modbus Time in milliseconds. A connection to
a server stays open after sending a request until
the time is expired. If there is another request
within this time, the timer is restarted
ByteOrder: Little or big endian. Modbus standard is big endian
Port: Modbus server TCP port
ErrorID: Error code describing error condition:
NO_ERROR: Execution successfully completed
ERR_ENDIANESS_NOT_SUPPORTED: Byte order not
supported
ERR_UNKNOWN: Undefined error

February 1, 2024 Slide 33 AC500 V3



Evaluation of status information

General consideration for ‘ModTcpConfig’ and following Modbus function blocks

Done: Operation is completed without error, while outputs ‘Busy’ and ‘Error’ are FALSE. This output is
TRUE for at least one cycle or until input ‘Execute’ is set to FALSE
Busy: Operation is running, while outputs ‘Done’ and ‘Error’ are FALSE
Error: Operation is stopped with error, while outputs ‘Done’ and ‘Busy’ are FALSE.
This output is TRUE for at least one cycle or until input ‘Execute’ is set to FALSE
The output ‘ErrorID’ gives more details about the error.

ErrorID: Error code describing error condition. Please refer to library documentation

February 1, 2024 Slide 34 AC500 V3



Client FB: ModTcpMast
Configuring Modbus TCP client for communication

Execute: A rising edge starts the operation


Eth: Index number of the assigned interface
IPAdr: IP Address of the remote Modbus TCP server
UnitID: Unit Identifier for the Modbus TCP frame
Fct: Function Code as specified in Modbus Protocol
Specification
Addr: Operand/Register address in remote Modbus TCP
server
Nb: Amount of data units to be sent or received
Data: Address of local buffer for data to be sent or received
ErrorID: Error code describing error condition. Please refer to
the online help or library documentation

February 1, 2024 Slide 35 AC500 V3



Client FB: ModTcpMast2
Configuring Modbus TCP client for communication – extended FB in comparison to ModTcpMast

Addr: Operand/register address in remote Modbus TCP


server
Nb: Amount of data units to be sent or received
Data: Address of local buffer for data to be sent or
received
RespTimeout: Slave response timeout in ms
KeepAlive: Open Modbus Time in ms.
ByteOrder: Little or big endian; Modbus Standard is big
endian
Execute: A rising edge starts the operation
Port: TCP Port
Eth: Index number of the assigned interface
ResetOnClose: Reset connection when closing it (TRUE) or close
IPAdr: IP address of the remote Modbus TCP server (FALSE) like ModTcpMast
UnitID: Unit Identifier for the Modbus TCP frame ErrorID: Error code describing error condition.
Fct: Function code as specified in Modbus Protocol
Specification

February 1, 2024 Slide 36 AC500 V3



Client FB: ModTcpInfo

ERR_INTERNAL_ILLEGAL_ARGUMENT: Stack reports


illegal argument (internal error)
ERR_UNKNOWN: Undefined error

NumSrv: Maximum number of supported server connections


(PLC as Modbus TCP server)

Rdy: OpenModbus on TCP/IP processing ready

Stat: Status of OpenModbus on TCP/IP processing. Set to 0


in any case, output left for compatibility reasons only
Execute: A rising edge starts the operation
NumErrs: Number of errors occurred. Does not cover TCP/IP
Eth: Index number of the assigned interface. Input is issues like ‘failed to connect’, Modbus errors on
ignored, existing for compatibility reasons only established connections only
ErrorID: Code of error occurred during execution LastErr: Code of last error occurred. Set to 0 in any case, output
left for compatibility reasons only
NO_ERROR: Execution successfully completed
ERR_NOT_CONFIGURED: Modbus TCP not configured

February 1, 2024 Slide 37 AC500 V3



Server FB: ModTcpServOnOff (1)
Setting Modbus TCP server to active/passive mode

ErrorID: Error code describing error condition:


NO_ERROR: Execution successfully completed
ERR_INVALID_INTERFACE: Invalid Ethernet interface or no
server configured on Ethernet interface
ERR_ALREADY_IN_STATE: Server already in requested
state
ERR_SIMULTANEOUS_ACCESS: Server already accessed by
other FB instance, try again later on
ERR_FAILED_SET_STATE: Failed to set server to requested
state
ERR_INTERNAL_UNEXPECTED_STATE: Unexpected state.
Fatal internal error
Execute: A rising edge starts the operation
ERR_UNKNOWN: Undefined error
Eth: Index number of the assigned interface
On: Switch on (TRUE) or off (FALSE) server

February 1, 2024 Slide 38 AC500 V3



Server FB: ModTcpServOnOff (2)
Setting Modbus TCP server to active/passive mode

Set the parameter ‘Start behavior’ to ‘Inactive’

ErrorID: Error code describing error condition:


NO_ERROR: Execution successfully completed
ERR_INVALID_INTERFACE: Invalid Ethernet interface or no
server configured on Ethernet interface
Define server behavior in state ‘Inactive’
ERR_ALREADY_IN_STATE: Server already in requested
state
ERR_SIMULTANEOUS_ACCESS: Server already accessed by
other FB instance, try again later on
ERR_FAILED_SET_STATE: Failed to set server to requested
state
ERR_INTERNAL_UNEXPECTED_STATE: Unexpected state.
Fatal internal error
ERR_UNKNOWN: Undefined error

February 1, 2024 Slide 39 AC500 V3



DEMO SETUP

RS485 Cable

Node - 2 Node - 3
PM5072

Ethernet Cable

Switch
Modbus Modbus
TCP IP TCP IP
Device 1 Device 2

Q&A

Feedback

February 1, 2024 Slide 42

You might also like