Despite its age Modbus is still a very popular protocol in Industrial automation. To my surprise I couldn't find any book about it (except for the "Modbus for Field Technicians" publication by Chipkin). So I decided to give it a try, rework my Modbus (ASCII,RTU,TCP) course material in book format, discussing all applicable (and missing) OSI-layers augmented by my own 25-year+ Modbus experience. I have made an excerpt of it, published here: www.enodenetworks.com/assets/docs/ModbusManualDraft.pdf.
What I don't know, but would like to know, is: does this fill a need? What would you like to have covered in it? Please let me know what you think of it. If enough positive reactions, I'll finish it!
I think that's a great idea.
Modbus Organization would be happy to post a link to such a book on its Technical Resources page for people to access easily, if you are interested. There are always users looking for more information, tips, and engineering experiences and practices with regard to Modbus.
Looking forward to learning more.
You beat me to it, Ron. Good for you. I'd been thinking about cranking out a Modbus book, too.
One thought that crossed my mind was reverse ordering chapters where I'd start with troubleshooting problem chapter first, then work forwards into what Modbus is and how it works, primarily because most people stumble into Modbus because that's what arrives on their equipment and they're stymied when they find out it definitely isn't plug and play.
Anyhow, I started writing some notes, below, but then realized that your posted link appears to be a partial document only, not all page numbers are there. So you might well have addressed all or any of them.
1. page 43 (pdf) Problems
- RS-485 driver lines A/B or D+/D- (or whatever they are labeled) are cross connected because labeling between vendors is not consistent.
29 May, 2005 - 5:53 pm
EIA-485 unfortunately defined A/B as logical & not electrical meaning. Thus one of the oldest chip lines (the TI
SN75176) labelled its pins for tele comm usage in the old transister-logic days when 5v = binary 0, and 0v = binary 1.
All of the hundreds of newer chips have followed this convention. So product vendors who "assume" Texas
Instrument knew what they were doing label their A/B "backwards" from how modern computers use the wires. Other
vendors "fix" this backwards labeling and connect the TI chip "A" to their "B" and so on.
End result is from now to eternity you'll NEVER be able to know without testing if one vendor's "A" is another
vendor's "A" or "B". Fortunately, EIA-485 chips cannot be damaged by reverse wiring
- Lynn A Linse, www.digi.com
2. page 49 RS-485, 2. The physical Link
It might be worth mentioning that in RS-485 the positives all connect to one another and the negatives connect to one another, for instance
TxD- connects to RxD- connects to D- connects to A(-)
TxD+ connects to RxD+ connects to D+ connects to B(+)
or should, unless the vendor labels the terminals "backwards" from others.
When creating a 2 wire connection from 4 wire terminals, (+) connects to (+) and (-) connects to (-).
3. You might want to mention of 5/6 digit addressing, ie (4)0031 vs (4)00031 where older version 5 digit addressing might only support up to 9999 register addresses. The graphic on page 26 (pdf) (39 print) has classic (legacy) 5 digit addressing.
4. The leading numeral in the register address, for example the (4) in (4)0032, is not part of the Modbus message. The leading numeral is merely an identifier as to the data's source memory location, ie. a Holding Register, an Input Register or a Discrete input
5. The dreaded "one offset" issue in register addressing.
How important it is to read a known, non-zero value to check to make sure that the addressing is correct.
6. For the IEEE 754 32 bit floating point (sometimes called 'real') number format, there are four byte/word order/sequences, two of which are common and are sometimes referred to as Big Endian or Little Endian. It dates back to the different methods Motorola or Intel used to handle floating point in their uP processors.
The IEEE Floating Point Data Format is a 23 bit signed binary with 8 bit biased binary exponent
mantissa x 2 ^(exponent -127)
For purposes of defining byte order, the 32 bit word starts with the sign bit, followed by an 8 bit exponent and a 23 bit mantissa: byte 4 byte 3 byte 2 byte 1, where byte 4 includes the sign bit and part of the exponent.
Floating Point Big Endian Format: 4, 3, 2, 1
Floating Point Big Endian with byte-swapped: 3, 4, 1, 2
Floating Point Little Endian Format: 1, 2, 3, 4
Floating Point Little Endian with byte-swapped: 2, 1, 4, 3
Most master/clients offer the choice of interpreting 32 bit FP with either FP Big Endian (Motorola) and FP Little Endian byte-swapped (Intel)
7. Page 51 (pdf) (106 print)
Why does the label for the terminating resistors at the top say "1 or 3" one or three what?
8. Page 51 (pdf) (106 print)
Please, please, note that shielded twisted pair should be used by convention and experience.
CAT 5 works great and has an extra conductors to use for connecting a signal ground.
The world uses lots of screw terminals
Here's a collection of screen shots of labeled terminal connections from manuals that I had laying around:
10. Page 26 pdf (39 print)
What happened to memory area 20000-29999? Nobody knows. Love it. LOL.
Another mystery of the ages: why is FC 03 used to address holding registers 40001-49999, whereas FC04 is used to address input registers 30001 - 39999?
11. Multiple RTU masters
There are vendors who have commercial products that can 'moderate' an RTU network and manage 2 masters on an RTU network - Miille.com
12. The Death of Modbus
Like Mark Twain is reported to have said, Reports of (the) death (of Modbus) have been greatly exaggerated".
13. Modbus is Not qualified for use as a safety protocol
14. List of Modbus Master test apps and links (I can dig mine out if you want)
15. Modbus/UDP ?
16. Modbus Plus is a proprietary, licensed protocol
This is awesome and fills a definite need. For content, you should look back at
the questions on this list, many questions from folks who don't have the
foggiest idea how to implement the physical network. And the other large
grouping is around addressing. This is mostly relating to RS485 Modbus RTU.
You should include how someone _should_ build a network along with the type
of info I often refer people to, an old TI application note "Ten Ways to
Bulletproof A 485 network" or something similar. The information that seem
to be inobtainium is things like: What cable to use, (even the TI note
doesn't cover this). termination, the elusive signal ground reference. You
do cover the A/B, +/-. craziness. A lot of the information available is too
high level (which is needed too) but the physical and practical is often
left to trial and error because you can do a RS485 network many ways, some
of which will work.
What is needed is best practices. If you understand
transmission lines and know what you're doing, you can get creative and
clever. But if you don't, having a cook book approach that is most likely
to work can be very valuable. Even starting with the right types of cable
would eliminate a great deal of later problems. Because Modbus RTU on RS485
is robust, there are a lot of networks out there that "kinda" work, and
it's often difficult or not cost effective to fix.
Good job, Curt.
I second all your suggestions. They go right to the heart of the problems that show up here time and time again.
Great work, hats off to you for putting forth the effort.
A good Modbus book is sorely needed. Despite all the hype, we all know Modbus is far from dead.
<Moderator's Note: This was originally a new thread, but I linked it to the original thread. We do not usually post sales type messages. I decided that this would be OK as part of the original thread. Rob, I would also contact Lenore Tracey at Modbus Organization since she also sounded interested in her post to this thread.
Modbus book - full draft 2 available
Some time ago I inquired about the interest for a book about Modbus (here in this forum and in others). I got a lot of positive responses, so I have now finished the Modbus book in draft. It took some more time than I expected, now having 140 pages... and I have the idea that not all is covered. But for now, there's something to read!
You can get the PDF at: http://www.enodenetworks.com/assets/docs/ModbusManualDraft.pdf
For those more comfortable with a paper version, I'll have professionally printed a number of copies (softcover), without the watermark, for a price of about $35 (not definitive yet), without postage and handling. If interested in having these, please contact me (see email in the above pdf).
Anyway, enjoy! I hope it fills a need, and if you have any ideas for extensions, let me know!