Modbus Book Chapters 1 3
Modbus Book Chapters 1 3
JOHN RINALDI
JOHN RINALDI
ISBN-13: 978-1517764685
ISBN-10: 1517764688
THE EVERYMAN’S GUIDE TO MODBUS
DEDICATION
TABLE OF CONTENTS
DEDICATION ......................................................... iii
TABLE OF CONTENTS ...........................................v
TABLE OF FIGURES ............................................. vii
TABLE OF TABLES................................................ vii
ACKNOWLEDGMENTS .......................................... i
FOREWORD .............................................................. 3
INTRODUCTION..................................................... 7
A LITTLE MODBUS HISTORY ............................. 13
WHY MODBUS HAS FLOURISHED .................... 16
MODBUS DATA REPRESENTATION ................. 21
MODBUS TRANSPORT LAYERS ......................... 26
MODBUS – THE DETAILS..................................... 35
MODBUS FOR SOFTWARE DEVELOPERS ........ 51
MODBUS ROUTERS .............................................. 57
THE MODBUS ORGANIZATION ........................ 63
MODBUS CERTIFICATION.................................. 67
MODBUS PLUS........................................................ 70
MODBUS & OTHER PROTOCOLS...................... 72
MODBUS & OPC UA.............................................. 79
MODBUS WILL LIVE FOREVER .......................... 83
MODBUS & REAL TIME AUTOMATION .......... 86
TABLE OF FIGURES
Figure 1 - Typical Relay Panel ................................... 14
Figure 2 - Master/Slave Modbus Architecture............ 18
Figure 3 - Modbus Message Structure ......................... 27
Figure 4 - Serial Modbus Message Structure ............... 49
Figure 5 - Modbus TCP Message Structure ................ 49
Figure 6 - Elecsan Headquarters ................................. 58
Figure 7 - Elecsan Remote Monitoring Architecture .60
Figure 8 - Modbus Organization Membership Logo .. 66
TABLE OF TABLES
Table 1 - Modbus Message Components .................... 37
Table 2 – Read Coil Structure .................................... 37
Table 3 – Read Input Coil Structure .......................... 38
Table 4 – Read Holding Registers Structure ............... 39
Table 5 – Read Input Registers Structure ................... 40
Table 6 – Write Single Coil Structure ........................ 41
Table 7 – Write Single Register Structure................... 42
Table 8 – Write Multiple Coil Structures ................... 43
Table 9 – Write Multiple Registers Structure ............. 44
Table 10 – Read/Write Register Structure ................. 45
vii
THE EVERYMAN’S GUIDE TO MODBUS
vi
JOHN RINALDI
ACKNOWLEDGMENTS
This book would not be possible without the
dedication, friendship, persistence, support and follow
through of the entire staff at Real Time Automation.
Specifically, to Drew Baryenbruch for pushing me to do
this book and freeing me of daily sales and marketing so
that I can take on projects like this.
ii
THE EVERYMAN’S GUIDE TO MODBUS
i
THE EVERYMAN’S GUIDE TO MODBUS
FOREWORD
Modbus Changed the World!
3
JOHN RINALDI
4
THE EVERYMAN’S GUIDE TO MODBUS
William Lydon
5
JOHN RINALDI
Editor, Automation.com
May, 2015
6
THE EVERYMAN’S GUIDE TO MODBUS
INTRODUCTION
A Book on Modbus?
7
JOHN RINALDI
8
THE EVERYMAN’S GUIDE TO MODBUS
9
JOHN RINALDI
But the other side of the coin is that all this simplicity
leads to some distinct disadvantages including:
1. No Device Profiles
10
THE EVERYMAN’S GUIDE TO MODBUS
John Rinaldi
June 1, 2015
Paris, France
11
JOHN RINALDI
12
THE EVERYMAN’S GUIDE TO MODBUS
13
JOHN RINALDI
14
THE EVERYMAN’S GUIDE TO MODBUS
15
JOHN RINALDI
16
THE EVERYMAN’S GUIDE TO MODBUS
17
JOHN RINALDI
MASTER SLAVE
Initiate Request
Process Response
18
THE EVERYMAN’S GUIDE TO MODBUS
19
JOHN RINALDI
20
THE EVERYMAN’S GUIDE TO MODBUS
21
JOHN RINALDI
Coils:
Coils are simply single bits. The bits can be ON (1) or
they can be OFF (0). Some coils represents inputs,
meaning they contain the status of some physical discrete
input. Or they represent outputs, meaning that they hold
the state of some physical discrete output signal.
Registers:
Registers are simply 16-bit unsigned register data.
Registers can have a value from 0 to 65535 (0 to FFFF
hexadecimal). There is no representation for negative
values, no representation for values greater than 65535,
and no representation for real data like 200.125.
Applications can impose these representations on
registers. For example, a register can treat two registers,
the first containing 200 and the second containing 125, as
200.125. Or an application can group four registers and
place a 64-bit IEEE floating point bit pattern in those
registers. Any application can organize and treat register
data in any way it may want, but there is no way for any
other Modbus device to automatically know what that
representation is. A Modbus application that reads
registers from a Modbus Slave device must have some
prior knowledge of how particular registers are treated
to process them correctly.
Registers are grouped into Input Registers and
Holding Registers. Like Input Coils, Input Registers
report the state of some external input as a value between
0 and 65535. The original intent of an Input Register was
22
THE EVERYMAN’S GUIDE TO MODBUS
23
JOHN RINALDI
24
THE EVERYMAN’S GUIDE TO MODBUS
25
JOHN RINALDI
Hey there.
26