Sie sind auf Seite 1von 18

Modbus

ASID14000094, Rev. 1.0, April 2014


The content of this manual has been carefully revised, however, the full compliance of its content with
the technical and functional characteristics of the product it is referred to cannot be assured, as typing
or other errors cannot be completely ruled out. The information given is regularly reviewed and any
necessary correction or additional explanation will be included in future revisions of this document.
Due to continuous development, the content of this manual can be changed without notice.
We appreciate any correction or improvement suggestion.

ii TPU S220 - User Manual - Modbus, N. ASID14000094, Rev. 1.0, April 2014
Manual Revisions

Reviewed by Date Changes


1.0 15/04/2014 English version of Portuguese manual ASID13000132

TPU S220 - User Manual - Modbus, ASID14000094, Rev. 1.0, April 2014 iii
GLOSSARY

A/D Analogue / Digital


CPU Central Processing Unit
DNP Distributed Network Protocol
I/O Input / Output
IRIG-B Inter-Range Instrumentation Group
LAN Local Area Network
LED Light Emitting Diode
MAC Medium Access Controller
PC Personal Computer
PECL Positive Emitter Coupled Logic
PHY Physical Layer Entities
RS232 Serial protocol for data transmission using DB9 cable
RS485 Protocol of data transmission by twisted pair 485
SCADA Supervisory Control and Data Acquisition
STP Shielded Twisted Pair
UART Universal Asynchronous Receiver/Transmitter
UC Central Unit
RTU Remote Terminal Unit
UC 500(H) Efacec Central Unit
UTP Unshielded Twisted Pair
μC Microcontroler

iv TPU S220 - User Manual - Modbus, N. ASID14000094, Rev. 1.0, April 2014
TABLE OF CONTENTS

1 COMMUNICATIONS ..................................................................................................... 1-1


1.1 MODBUS PROTOCOL (SLAVE).................................................................................................1-3
1.1.1 Architecture.................................................................................................. 1-3
1.1.2 Configuration ................................................................................................ 1-3
2 ANNEXES ................................................................................................................. 2-1
2.1 MODBUS PROTOCOL (SLAVE) INTEROPERABILITY PROFILE ......................................................................2-3
2.1.1 Application Data Unit TCP/IP ............................................................................. 2-3
2.1.2 Application Data Unit Serial............................................................................... 2-3
2.1.3 Supported formats.......................................................................................... 2-4
2.1.4 F1 - Consecutive reading of n bits ....................................................................... 2-4
2.1.5 F2 - Consecutive reading of n bits ....................................................................... 2-5
2.1.6 F3 - Consecutive reading of n words .................................................................... 2-5
2.1.7 F4 - Consecutive reading of n words .................................................................... 2-5
2.1.8 F5 - Writing one bit ......................................................................................... 2-6
2.1.9 F6 - Writing of a word...................................................................................... 2-6
2.1.10 F15 - Consecutive writing of n bits ..................................................................... 2-7
2.1.11 F16 - Consecutive writing of n words .................................................................. 2-7
2.1.12 Exception answer.......................................................................................... 2-7
2.1.13 Algorithm of cyclic redundancy check - CRC16 ...................................................... 2-8

TPU S220 - User Manual - Modbus, ASID14000094, Rev. 1.0, April 2014 v
LIST OF TABLES

Table 2-1 Possible bit formats ........................................................................................... 2-4


Table 2-2 Possible bit formats ........................................................................................... 2-4
Table 2-3 Exception codes................................................................................................ 2-7

vi TPU S220 - User Manual - Modbus, N. ASID14000094, Rev. 1.0, April 2014
Chapter

COMMUNICATIONS
1
This chapter describes all communication interfaces supported by TPU S220 as RS232, RS485, optical fibre
connections, Ethernet, etc. Different communication protocols are supported over physical interfaces for the
connection to SCADA systems such as Modbus Slave.
Chapter 1 - Communications

TABLE OF CONTENTS

1.1 MODBUS PROTOCOL (SLAVE) ................................................................................................ 1-3

Total of pages of the chapter: 3

1-2 TPU S220 - User Manual - Modbus, N. ASID14000094, Rev. 1.0, April 2014
c

1.1 MODBUS PROTOCOL (SLAVE)

1.1.1 ARCHITECTURE
The TPU S220 enables TCP/IP, differential bus-bar or serial connection targeted for the communication with
control and supervision devices, etc. Half-duplex communication is now supported

Data Model
The datamodels to be used is not defined by any standard. Thus, each device manufacturer should define the
datamodel and refer to it in the corresponding manual. However, this protocol covers a set o measurements
that are suitable to most of different situations.

1.1.2 CONFIGURATION
The parameters of ModBus protocol may be configured and visualized using the configuration tool Automation
Studio Designer.
These are the functions currently supported:

Function Description
F1 Consecutive reading of n bits
F2 Consecutive reading of n bits
F3 Consecutive reading of n words
F4 Consecutive reading of n words
F5 Writing one bit
F6 Writing a word
F15 Consecutive writing of n bits
F16 Consecutive writing of n words

TPU S220 - User Manual - Modbus, ASID14000094, Rev. 1.0, April 2014 1-3
Chapter

ANNEXES
2
The annexes below may complement the information of the previous chapters.
Chapter 2 - Annexes

TABLE OF CONTENTS

2.1 MODBUS PROTOCOL (SLAVE) INTEROPERABILITY PROFILE ..................................................................... 2-3

Total of pages of the chapter: 8

2-2 TPU S220 - User Manual - Modbus, N. ASID14000094, Rev. 1.0, April 2014
Chapter 2- Annexes

2.1 MODBUS PROTOCOL (SLAVE)


INTEROPERABILITY PROFILE

The functions now deployed in this protocol are basically reading or writing bits and words. Where applicable,
the supported data model is described; this information is described below.

2.1.1 APPLICATION DATA UNIT TCP/IP

Request

Description Size
Transaction identification 2 Bytes ----
Protocol identifier 2 Bytes 0x0000
Frame size 2 Bytes ----
Information x Bytes PDU

Response

Description Size

Transaction identification 2 Bytes ----


Protocol identifier 2 Bytes 0x0000
Frame size 2 Bytes ----
Information x Bytes PDU

Maximum size of a ADU is 256 bytes.


Maximum size of a PDU is 253 bytes.

2.1.2 APPLICATION DATA UNIT SERIAL

Request

Description Size
Slave identification 1 byte ----
Information x Bytes PDU
CRC16 2 Bytes (LSB+MSB)

Request

Description Size
Slave identification 1 byte ----
Information x Bytes PDU
CRC16 2 Bytes (LSB+MSB)

Maximum size of a ADU is 260 bytes.

TPU S220 - User Manual - Modbus, ASID14000094, Rev. 1.0, April 2014 2-3
Chapter 2 - Annexes

Maximum size of a PDU is 253 bytes.

2.1.3 SUPPORTED FORMATS


Table 2-1 Possible bit formats

Bit format Size


Single 1 bit
Double 2 bits
2-Bit enumerated 2 bits
3-Bit enumerated 3 bits
4-Bit enumerated 4 bits

Table 2-2 Possible bit formats

Word format Size


UINT16 1 word
INT16 with offset 1 word
UINT32 2 words
INT32 with offset 2 words
UINT64 4 words
INT64 with offset 4 words
FLOAT32 IEEE754 standard (LSW-MSW) 2 words
FLOAT64 IEEE754 standard (LSW-MSW) 4 words
INT16 2's complement 1 word
INT32 2's complement 2 words
INT64 2's complement 4 words
Short unsigned FLOAT16 1 word
Unsigned measurement 32 2 words
Signed measurement 32 2 words
FLOAT32 IEEE754 standard (MSW-LSW) 2 words
FLOAT64 IEEE754 standard (MSW-LSW) 4 words

2.1.4 F1 - CONSECUTIVE READING OF N BITS

Request

PDU Description Size

Function code 1 byte 0x01


Address of the 1st bit 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)
Quantity of bits 2 Bytes 0x0001 to 0x07D0 (MSB+LSB)

Request

PDU Description Size

2-4 TPU S220 - User Manual - Modbus, N. ASID14000094, Rev. 1.0, April 2014
Chapter 2- Annexes

Function code 1 byte 0x01


Number of bytes 1 Bytes N*
Value of bits n bytes n = N or N+1
N* = Quantity of bits / 8, if the rest isn't null, so: N = N+1

2.1.5 F2 - CONSECUTIVE READING OF N BITS

Request
PDU Description Size

Function code 1 byte 0x02


Address of the 1st bit 2 Bytes 0x0000 a 0xFFFF (MSB+LSB)
Quantity of bits 2 Bytes 0x0001 to 0x07D0 (MSB+LSB)

Request

PDU Description Size

Function code 1 byte 0x02


Number of bytes 1 Bytes N*
Value of bits n bytes n = N or N+1
N* = Quantity of bits / 8, if the rest isn't null, so: N = N+1

2.1.6 F3 - CONSECUTIVE READING OF N WORDS

Request

PDU Description Size

Function code 1 byte 0x03


Address of the 1st word 2 Bytes 0x0000 a 0xFFFF (MSB+LSB)
Quantity of words 2 Bytes 0x0001 to 0x07D0 (MSB+LSB)

Request

PDU Description Size


Function code 1 byte 0x03
Number of bytes 1 Bytes n = 2 x N*
Words value n bytes (MSB+LSB)
N* = Quantity of words

2.1.7 F4 - CONSECUTIVE READING OF N WORDS

Request

PDU Description Size


Function code 1 byte 0x04
Address of the 1st word 2 Bytes 0x0000 a 0xFFFF (MSB+LSB)

TPU S220 - User Manual - Modbus, ASID14000094, Rev. 1.0, April 2014 2-5
Chapter 2 - Annexes

Quantity of words 2 Bytes 0x0001 to 0x07D0 (MSB+LSB)

Request

PDU Description Size


Function code 1 byte 0x04
Number of bytes 1 Bytes n = 2 x N*
Words value n bytes (MSB+LSB)
N* = Quantity of words

2.1.8 F5 - WRITING ONE BIT

Request

PDU Description Size


Function code 1 byte 0x05
Address of the bit 2 Bytes 0x0000 a 0xFFFF (MSB+LSB)
Bit value 2 Bytes 0x0000 or 0xFF00 (MSB+LSB)

Answer (it's an echo request, indicating that the slave has processed the value of the request)
PDU Description Size

Function code 1 byte 0x05


Address of the bit 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)
Bit value 2 Bytes 0x0000 or 0xFF00 (MSB+LSB)

2.1.9 F6 - WRITING OF A WORD

Request

PDU Description Size


Function code 1 byte 0x06
Address of the word 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)
Word value 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)

Answer (it's an echo request, indicating that the slave has processed the value of the request)

PDU Description Size


Function code 1 byte 0x06
Address of the word 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)
Word value 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)

2-6 TPU S220 - User Manual - Modbus, N. ASID14000094, Rev. 1.0, April 2014
Chapter 2- Annexes

2.1.10 F15 - CONSECUTIVE WRITING OF N BITS

Request

PDU Description Size

Function code 1 byte 0x0F


Address of the 1st bit 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)
Quantity of bits 2 Bytes 0x0001 to 0x07B0 (MSB+LSB)
Number of bytes 1 byte N*
Value of bits n bytes n = N or N+1
N* = Quantity of bits / 8, if the rest isn't null, so: N = N+1

Request

PDU Description Size


Function code 1 byte 0x0F
Address of the 1st bit 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)
Quantity of bits 2 Bytes 0x0001 to 0x07B0 (MSB+LSB)

2.1.11 F16 - CONSECUTIVE WRITING OF N WORDS

Request

PDU Description Size


Function code 1 byte 0x10
Address of the 1st word 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)
Quantity of words 2 Bytes 0x0001 to 0x007B (MSB+LSB)
Number of bytes 1 byte n = 2 x N*
Words value n bytes

Request

PDU Description Size


Function code 1 byte 0x10
Address of the 1st word 2 Bytes 0x0000 to 0xFFFF (MSB+LSB)
Quantity of words 2 Bytes 0x0001 to 0x007B (MSB+LSB)

2.1.12 EXCEPTION ANSWER


It's possible that a slave returns an exception answer when a request is sent, by indicating a request error or
communication incompatibility.
Table 2-3 Exception codes

Code Size
0x01 Unknown function code
0x02 Incorrect address

TPU S220 - User Manual - Modbus, ASID14000094, Rev. 1.0, April 2014 2-7
Chapter 2 - Annexes

0x03 Incorrect information


0x04 Unprepared slave
0x07 Not confirmed

Please consider the possibility of jamming in the EIA485 bus-bar that change the communication frame content
or even unable its transmission, the slave will not answer.

Answer

PDU Description Size


Function code 1 byte 0x80 | Function code
Exception code 1 byte

2.1.13 ALGORITHM OF CYCLIC REDUNDANCY CHECK - CRC16


The algorithm of cyclic redundancy check used in the ModBus protocol is the CRC16 , also known by CRC16-
IBM or CRC16-ANSI. This algorithm is based in the polynomial P( x)  x16  x15  x 2  1 , also known by
1010 0000 0000 0001b.

2-8 TPU S220 - User Manual - Modbus, N. ASID14000094, Rev. 1.0, April 2014

Das könnte Ihnen auch gefallen