1. Trang chủ
  2. » Giáo án - Bài giảng

Data Communication And Networking

50 422 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 50
Dung lượng 1,48 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

MODBUS ASCII and RTU  ASCII transmission mode: Each eight-bit byte in a message is sent as 2 ASCII characters..  A master addresses a slave by placing the slave address in the address

Trang 2

Data link layer Protocols

 Chapter 4: Industrial Networks

2

Trang 3

MODBUS

MODBUS Protocol is a Serial Communication Protocol created

by MODICON company to connect PLC to programming tools.

It is now widely used to establish master-slave communication

between intelligent devices.

MODBUS is independent of the physical layer.

Trang 4

r

MODBUS

using a master/slave medium access with a

Application Presentation

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

Trang 6

MODBUS

token passing derivative

messaging structure.

that uses the MODBUS

Application Presentation

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

Trang 7

MODBUS ASCII and RTU

 ASCII transmission mode: Each eight-bit byte in a message is sent as 2 ASCII

characters.

RTU transmission mode: Each eight-bit byte in a message is sent as two four-bit

hexadecimal characters.

achieves higher throughput.

it

causing an error.

Trang 8

MODBUS Frame Structure

(master to slave messages)

8

Trang 9

 A master addresses a slave by placing the slave address in the

address field of the message.

Response :

Trang 10

original function code.

code that is equivalent to the original function

code with its most significant bit set to a logic 1

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

10

Trang 11

Data field

 Valid codes are in the range of 0 255 decimal.

The data field contains additional information which the

slave must use to take the action defined by the function

code This can include items like register addresses,

quantity of items to be handled, etc

Response :

If no error occurs, the data field contains the data

requested.

If an error occurs, the field

the master application can

contains an exception code that use to determine the next

Address Function Data Checksum

Trang 12

Data field

 Modbus ASCII uses LRC :

 The checksum is re-calculated by the slave and compared to the

value sent by the master.

 If a difference is detected, the slave will not construct a

response to the master.

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

12

Address Function Data Checksum

Trang 13

Frame example in RTU mode

Number of bytes read

Value of the first word

Value of the last word CRC16

Slave

Address

Function code = 03

First word address

Number of words to read CRC16

Trang 14

Frame example in RTU mode

14

Slave

Address

Function code = 06

Word address

Word address

Value of word

CRC16

Trang 15

Frame example in RTU mode

First word address

First word address

Number of words to write

Number of bytes Value of the first

word CRC16

Trang 16

Function Code Example

Code Function

01 02 03 04 05 06 15 16 23 43

(0x01) (0x02) (0x03) (0x04) (0x05) (0x06) (0x0F) (0x10) (0x17) (0x2B)

Read Coils Read Discrete Inputs Read Holding Registers Read Input Registers Write

Write Write Write

Single Coil Single Register Multiple Coils Multiple Registers

Read/Write Multiple Registers Read Device Identification

The complete description of all Modbus request is freely available on the Modbus.org web site : http://www.modbus.org

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

16

Trang 17

Error checking methods

 The entire message frame must be transmitted as a continuous stream.

 If a silent interval (more than 1.5 character times RTU mode or 1 second ASCII mode) occurs before

completion of the frame, the receiving device flushes the incomplete message and assumes

that the next byte will be the address field of a new message.

Trang 18

Error checking methods

predetermined timeout

transaction.

interval before aborting the

respond normally.

 If the slave detects a transmission error, the message will not be acted upon.

The slave will not construct a response to the master.

 Thus the timeout will expire and allow the master's

program to handle the error.

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

18

Trang 20

New Modbus RS485 standard schematic

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

20

Maximum number of stations (without repeater) 32 (31 slaves)

Maximum length of tap links 20 m for one tap link

40 m divided by the number of tap links Bus polarisation 650 Ω at 5V and common for the master

Line terminator 120 Ω - 0,25Wm in series with 1nF 10V

Trang 22

Main characteristics resume

 Method of accessing the

22

Trang 23

MODBUS TCP

world more interested with interconnecting to

Ethernet networks and more specially, IP/Ethernet

Trang 24

MODBUS TCP - Interconnection

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

24

Trang 25

MODBUS TCP Operation

A Request is sent by the client to initiate a transaction

An Indication is sent by the server to confirm that the request

Trang 26

MODBUS TCP ADU 

MODBUS TCP/IP Application Data Unit (PDU) is implemented by using

Transaction Identifier: supplied by the client and keep track of specific

requests The server is to send back with the same identifier with its

response

Protocol Identifier: support multiple protocols

Length: identifies the length of all remaining fields including MODBUS

26

Trang 27

Controller Area Network (CAN)

Invented by Robert Bosch GmbH in 1980 for automotive

applications

Asynchronous Serial Bus

Simple 2-wire differential bus, , bi-directional

communication link with data transmitted according to

priority

A digital communication link between multiple Electronic

Control Modules (ECM)

Absence of node addressing

 Sophisticated error detection & handling system

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

27

Trang 28

Controller Area Network (CAN)

 Improved diagnosis facilities

 Rapid transmission rates

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

28

Trang 29

Controller Area Network (CAN)

networks Depending on model and year the following may be used

Trang 30

Controller Area Network (CAN)

30

Trang 31

Controller Area Network (CAN)

With CAN:

Trang 32

Controller Area Network (CAN)

Physical layer – built on bit dominance

Protocol layer – binary countdown

Message filtering layer (with add-on protocols)

 Keep an eye out for:

32

Trang 33

Controller Area Network (CAN)

 CAN only standardizes the

Methods for fault detection and fault confinement

 Other high-level protocols

are used for application

layer

 User defined

 Other standards

Trang 34

CAN – Bit Countdown

Each node is assigned a unique

identification number

 All nodes wishing to transmit

compete for the channel by

transmitting a binary signal based

on their identification value

 A node drops out the

competition if it detects a

dominant state while

transmitting a passive state

Thus, the node with the lowest

identification value wins

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

34

Trang 35

CAN – Bit Dominant

CAN uses the idea of recessive

and dominant bits

 Wired “OR” design

 Bus floats high unless a transmitter

pulls it down (dominant)

transmission floats low and

transmitter pulls up)

High is “recessive” value

value seen on the bus

Low is “dominant” value

35

Trang 36

Ex: Binary Countdown

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

36

Trang 37

Physical Layer Possibilities

 Specifically rules out transformer coupling for high-noise applications

 Differential driver used

Trang 38

Non-Return to Zero (NRZ) Encoding

 Worst case can have all zero or all one in a message – no edges in data

 Simplest solution is to limit data length to perhaps 8 bits

message

• This is the technique commonly used on computer serial ports / UARTs

 Bandwidth is one edge per bit

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

38

Trang 39

Bit Stuffing To Add Edges To NRZ Encoding

Long NRZ messages cause problems in receivers

Solution: add “stuff bits”

 Stuff bits are extra bits added to force transitions regardless of data

 Typical approach: add an opposite-valued stuff bit after every 5 identical

bits

values

Trang 40

CAN - Message Format

SOF – Start of frame (SYNC symbol):

Single dominant bit

Arbitration field – binary countdown priority value; set by

Data field: 0 to 8 bytes

CRC field: 15-bit CRC, followed by one recessive delimiter bit

ACK field: If message received OK, assert as dominant bit (at

least one node received)

END of frame delimiter: 7 recessive bits mark end of

frame(phase violation for bit stuff pattern)

40

Trang 41

CAN - Error Detection

Trang 42

“Big” and “Small” nodes

 Many message mailboxes/filters

 Fast processor

 One or two mailboxes/filters

 Slow processor

 System designer has to prevent message over-run

of:

via one

 Dedicated mailbox per message (hardware ensures no data lost)

 If mailbox shared, ensure messages to slow processors are

spaced apart •

Must be infrequent Must ALSO not be clumped closer than receiver response time This ends up being a constraint for real time scheduling (a later

lecture)

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

42

Trang 43

“Big ” and “Small” nodes

 Message object holds most recent

message for that type – not a

Trang 44

Mask Registers

Used to set up message filters

 Mask register selects bits to examine

 Object Arbitration register selects bits that must match to be

44

Trang 45

Mask Registers: Example

Trang 46

DeviceNet

Based on top of CAN

Used for industrial control (valves, motor starters,

display panels, …)

• Caterpillar is a member of ODVA as well (Open DeviceNet

Vendors Assn.), but for factory automation.

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

46

Trang 47

• Single receiver mailbox then holds most recently received button press message Message must be processed before next such message is received

Trang 48

DeviceNet Group Strategy

Prioritized by Message ID / Node number

High priority messages with fairness to nodes

Prioritized by Node number / Message ID

 Gives nodes priority

48

Trang 49

CAN

GPS GSM

Controller area network

G b l System for Mobile Communi c ations

Trang 50

CAN Tradeoff

Advantages:

Disadvantages:

 Requires bit dominance (can’t be used with transformer coupling)

 Unfair access - node with a high priority can "hog" the network

Optimized for:

Telecomm Dept.

Faculty of EEE

DCN-2013 HCMUT

50

Ngày đăng: 04/12/2016, 08:57

TỪ KHÓA LIÊN QUAN