21
MODBUS RTU CONFIGURATION INTRODUCTION: The following document is just an excerpt to show the communication between a MODBUS slave and AC800M as MODBUS Master.This is just a generalized approach for establishing communications between the 2 systems and the developer has to write application specific codes to satisfy their requirements. Modbus is a serial communications protocol published by Modicon in 1979 for use with its programmable logic controllers (PLCs). Modbus RTU is used in serial communication & makes use of a compact, binary representation of the data for protocol communication. The RTU format follows the commands/data with a cyclic redundancy check checksum as an error check mechanism to ensure the reliability of data. Modbus RTU is the most common implementation available for Modbus. A Modbus RTU message must be transmitted continuously without inter-character hesitations. Modbus messages are framed (separated) by idle (silent) periods. Modbus RTU Frame Format Name Length Function Start 3.5c idle at least 3-1/2 character times of silence (MARK condition) Address 8 bits Station Address Function 8 bits Indicates the function codes like read coils / inputs Data n * 8 bits Data + length will be filled depending on the message type CRC Check 16 bits Error checks End 3.5c idle at least 3-1/2 character times of silence between frames LIMITATIONS Since Modbus was designed in the late 1970s to communicate to programmable logic controllers, the number of data types is limited to those understood by PLCs at the time. Large binary objects are not supported. No standard way exists for a node to find the description of a data object, for example, to determine if a register value represents a temperature between 30 and 175 degrees. Since Modbus is a master/slave protocol, there is no way for a field device to "report by exception" (except over Ethernet TCP/IP, called open-mbus)- the master node must routinely poll each field device, and look for changes in the data. This consumes bandwidth and network time in applications where bandwidth may be expensive, such as over a low-bit-rate radio link.

MODBUS RTU CONFIGURATION - · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

  • Upload
    buihanh

  • View
    428

  • Download
    35

Embed Size (px)

Citation preview

Page 1: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION

INTRODUCTION:

The following document is just an excerpt to show the communication between a MODBUS slave

and AC800M as MODBUS Master.This is just a generalized approach for establishing communications

between the 2 systems and the developer has to write application specific codes to satisfy their

requirements. Modbus is a serial communications protocol published by Modicon in 1979 for use with

its programmable logic controllers (PLCs). Modbus RTU is used in serial communication & makes use of

a compact, binary representation of the data for protocol communication. The RTU format follows the

commands/data with a cyclic redundancy check checksum as an error check mechanism to ensure the

reliability of data. Modbus RTU is the most common implementation available for Modbus. A Modbus

RTU message must be transmitted continuously without inter-character hesitations. Modbus messages

are framed (separated) by idle (silent) periods.

Modbus RTU Frame Format

Name Length Function

Start 3.5c idle at least 3-1/2 character times of silence (MARK condition)

Address 8 bits Station Address

Function 8 bits Indicates the function codes like read coils / inputs

Data n * 8 bits Data + length will be filled depending on the message type

CRC Check 16 bits Error checks

End 3.5c idle at least 3-1/2 character times of silence between frames

LIMITATIONS

Since Modbus was designed in the late 1970s to communicate to programmable logic controllers,

the number of data types is limited to those understood by PLCs at the time. Large binary objects

are not supported.

No standard way exists for a node to find the description of a data object, for example, to

determine if a register value represents a temperature between 30 and 175 degrees.

Since Modbus is a master/slave protocol, there is no way for a field device to "report by

exception" (except over Ethernet TCP/IP, called open-mbus)- the master node must routinely poll

each field device, and look for changes in the data. This consumes bandwidth and network time

in applications where bandwidth may be expensive, such as over a low-bit-rate radio link.

Page 2: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION

Modbus is restricted to addressing 247 devices on one data link, which limits the number of field

devices that may be connected to a master station (once again Ethernet TCP/IP proving the

exception).

Modbus transmissions must be contiguous which limits the types of remote communications

devices to those that can buffer data to avoid gaps in the transmission.

Modbus protocol provides no security against unauthorized commands or interception of data.

STANDLONE SERIAL MODBUS ARCHITECTURE:

The application shows point to point configuration between AC800M and MODBUS slave.The

setup is built with PM866 processor ,one CI853 card ,RS232/485 convertor to allow communication for

long distances of more than 15 meters and a slave simulator .This also has an additional advantage of

providing electrical isoltaion in the system.The architectural diagram is as shown below:

CI853

RS232/ RS485

RS232/ RS485

Page 3: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION

STANDALONE ARCHITECTURE

CONTROL BUILDER:

1.Open a new project in the control builder.

Page 4: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 2. For AC800M to become a mosbus master ,we need to connect the CI853 card to it.So as a first

step,CI853 harware serial library needs to be added.

Page 5: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION This screen shot shows the hardware library after addition of CI853 card.

Page 6: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 4. In addition to the hardware library ,software library and a MODBUS hardware library also needs to be

inserted inorder to establish the modbus slave communication.A separate MODBUS library is needed

because CI853 is used for serial communication in general.So make it specific for MODBUS we need this

library.

I

Page 7: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION Next step is to configure the system identity information for the controller.In our case we have configured

it to 172.16.4.10

Page 8: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 4.We now have to connect the CI853 hardware library and MODBUS hardware library to the hardware

structure of the project to enable it to appear there.

Page 9: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION

Page 10: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 5.Now a CI853 card has to be added to 1 st location in the hardware structure which will enable us to

connect 247 slaves in a multidrop connection.But in our case we are just going to connect one slave

simulator.

Page 11: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 6. Modbus Slaves are to be connected to the channel 1 of the CI853 card.Hence the Com Settings of the

channel 1 are made as shown below.This is dependent on the slave device also.It should be noted that

the same Com configuration should be followed in slave also.

Page 12: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 7. A MODBUS Protocol has to be defined at Com Channel 1 of the CI853 card.

Page 13: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 8. Settings has to be made according to the slave device in MODBUS protocol editor.The pool time of the

MODBUS Protocol is dependent on the slave device.If Function code 8 is avialable in the slave device it

should be enabled.Otherwise make it zero for simulation.In the slave simulator that is employed in the

application ,loop back is not permitted.So poll time is made zero.

NOTE: CI853 is configurable only as MODBUS Master.And MODBUS RTU protocol does not

support redundancy at card level or port level.Application level redudancy is possible depending

upon requirements.

Page 14: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 9. Next step we can start configuring the application for MODBUS communication with the slave

device.But first software MODBUS library has to be updated in the connected library sections of the

application.Here programming is done via control module for ease of development.

Page 15: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION

Page 16: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 10. Application code is developed via structured code for the more clarity.Same code can be written in

structured text also.

MBConnect function block is inserted first to establish the connection between master and slave.This

block helps the master to identify the slave device and the valid output of the MB connect block denoted

the proper conection between both.Partner address denoted the slave address and communication

channel denoted the internal channel in control builder(location of the modus protocol) through which

datas are sent or recieved to the master.

A pulse generator is installed inorder to provide periodic signals to the read block and write block.Inorder

to give the period time and pulse time,we have created to project time constants with time of 5 sec and

2.5 sec

Page 17: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION

Page 18: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION 10. In a same way MB read and MB Write blocks needs to be inserted and connected as shown above.

In a MB Read block,Read Req is connected from the pulse generator output .Start addr of the MB

Read Block is framed according to IEC61131-5 direct addressing format.

Function Code MB Read MB Write Address range

Read Coil status(FC1) %QX 0xxxx

Read Input Coil status(FC2) %IX 1xxxx

Read Holding Registers

status(FC3)

%QW,%MW 4xxxx

Read Input Registers(FC4) %IW 3xxxx

Force Single Coil(FC5) %QX

Force Multiple Coils(FC15) %QX

Force Single Preset

register(FC5)

%QW,%MW

Force Multiple

Registers(FC15)

%QW

The same format is applicable for writing also.

NOTE:When Read request is available from the Read block and NDR is not enabled after a read

operation it means mainly there is a problem in addressing the registers.

Page 19: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION

Page 20: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION A few more snapshots to execute MODBUS Communication using structred text language:

Page 21: MODBUS RTU CONFIGURATION -  · PDF file · 2015-09-06MODBUS RTU CONFIGURATION STANDALONE ARCHITECTURE CONTROL BUILDER: 1.Open a new project in the control builder

MODBUS RTU CONFIGURATION