modbus data communication systems - eit
TRANSCRIPT
23/08/2013
1
www.eit.edu.au
Modbus Data communications
systems
by
Steve Mackay
www.eit.edu.au
EIT Micro-Course Series
• Every two weeks we present a 35 to 45 minute interactive course
• Practical, useful with Q & A throughout
• PID loop Tuning / Arc Flash Protection, Functional Safety, Troubleshooting conveyors presented so far
• Upcoming: – Electrical Troubleshooting and
much much more…..
• Go to http://www.eit.edu.au/free-courses
• You get the recording and slides
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
2
www.eit.edu.au
Overall Presentation
A review of the Modbus Protocol and
related some troubleshooting issues.
www.eit.edu.au
Objectives
• Give an introduction to Modbus
• Review simple troubleshooting steps
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
3
www.eit.edu.au
Topics
• Introduction to Modbus protocol
• Troubleshooting Modbus
• Conclusion
www.eit.edu.au
1.0 Introduction to Modbus
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
4
www.eit.edu.au
Objective
• The Modbus Messaging protocol
• The transportation of Modbus requests and responses on serial
networks
• Modbus memory allocation
• Modbus Function Codes and their application
• The difference between Modbus RTU and ASCII
• Troubleshooting Modbus systems in terms of:
No response to requests
Exception responses
www.eit.edu.au
Modbus messaging
• Application layer (OSI layer 7) protocol
that provides client/server communication
between devices connected to different
types of buses or networks
• ‘Request/Response’ type protocol and not
a ‘master/slave’ type protocol
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
5
www.eit.edu.au
Master-slave interaction
www.eit.edu.au
Modbus transaction
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
6
www.eit.edu.au
Modbus Serial communication stack
www.eit.edu.au
Protocol stack
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
7
www.eit.edu.au
Modbus Serial ADU
www.eit.edu.au
Modbus....
• The Function field
• The Data field
Allocation of Modicon memory address blocks
• The Address field
• The Error Check field
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
8
www.eit.edu.au
RTU mode
• 8 data bits, even, odd or no parity, 1 or 2 stop bits
• Gap of 3 ½ character lengths used for header(3 ½ mS)
• Same for trailer
• Gap in transmission >1,5ms causes frame to be discarded
• CRC error checking
• 999810 transmitted as <0x27><0x0E> (2 bytes)
RTU message frame
www.eit.edu.au
ASCII Mode
• 7 data bits, even, odd or no parity, 1 or 2 stop bits
• Header = : (colon)
• Trailer = <CR> <LF>
• Gaps of 1 second in frame acceptable
• LRC error checking (not CRC)
• 999810 (0x270E) transmitted as the ASCII string 270E i.e. <0x32><0x37><0x30><0x45> (4 bytes)
ASCII message frame
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
9
www.eit.edu.au
Function Code
• Read input discrete :
• FC01- reading coils-RTU mode :
www.eit.edu.au
Function Codes....
• Read multiple registers :
• FC04-reading input register
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
10
www.eit.edu.au
Function Codes....
• Write single register :
• Write coil :
www.eit.edu.au
Force multiple coils
• Write multiple registers :
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
11
www.eit.edu.au
2.0 Modbus - Troubleshooting
www.eit.edu.au
Typical problems
• Hardware or software problems :
Mis-wired communication cabling and faulty
communication interfaces
Controller application tries to access
non-existent target devices nodes or
use invalid Function Codes, address
non-existent memory locations in the
target devices, or specify illegal data
format types
• Hardware problems
• Software (protocol)
related problems
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
12
www.eit.edu.au
Tools used
RS-232 breakout boxes, RS-232 to RS-485
converters, continuity testers, voltmeters,
screwdrivers, pliers, crimping tools and
cabling tools.
• Hardware tools :
• Software tools Protocol analyzer
• Software troubleshooting
• Hardware troubleshooting
www.eit.edu.au
Overall Concept
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
13
www.eit.edu.au
Tools of the trade
• Cable tester
• TCP/IP (and other third party) Utilities
• Protocol Analyzer (e.g. Wireshark)
www.eit.edu.au
Hardware and Physical Cabling
• Check cable on both sides of connection
• Switch lights
• Incorrect wire type and components
• Straight versus cross over cable
• Excessive untwists
• Damaged RJ-45 connector
• Electrical noise and shielding
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
14
www.eit.edu.au
TCP/IP Utilities• Ping
• Arp
• Netstat
• Nbtstat
• Ipconfig
• Tracert
www.eit.edu.au
Ping -t• Easiest ways to test connectivity across the network and
confirm that an IP address is reachable
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
15
www.eit.edu.au
Arp -a
• Displays hardware and IP address
mapping
www.eit.edu.au
Netstat -e
• Displays activities since last reboot
• Useful data on any problems
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
16
www.eit.edu.au
Nbtstat
• Protocol Stats & TCP/IP connections
www.eit.edu.au
Ipconfig /all
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
17
www.eit.edu.au
Tracert
www.eit.edu.au
Packet Analysis
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
18
www.eit.edu.au
OSI Model
www.eit.edu.au
Packet Structure
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar
23/08/2013
19
www.eit.edu.au
Section 3Conclusion
www.eit.edu.au
Thank You For Your InterestIf you are interested in further training, please visit:
IDC Technologies Short Courses:
Two-day practical courses available to the public:
http://idc-online.com/workshops
IDC Technologies Conferences:
http://idc-online.com/conferences-main
The Engineering Institute of TechnologiesOnline Certificate and
Advanced Diploma programs:
www.eit.edu.au
Engineering Institute of Technology (EIT)
Modbus Data Communication Systems Webinar