Another Modbus question? Addressing

C

Thread Starter

Chris Haught

I know the four standard addresses 0X, 1X, 3X, & 4X, and their type differences. This brings me to my question. You see, the controller used by my company gets its protocol converted to Modbus via a Modbus Gateway. On some of our site locations, the Gateway is run into a Johnson's Metasys Integrator. The Gateway designates all the digital I/O has a 1X. However, the integrator from Johnson Controls uses 0X and 1X addresses. Everything works fine, but how is it that 0X and 1X addresses are interchangeable? Wouldn't this defeat the purpose of having 2 digital address types? If the 0X and 1X addresses are mirrors of each other, why the redundancy? Second, what other documents would you recommend for help with understanding Modbus? Thanks for any and all help.
 
L
When *YOU* design a protocol, there are a million "neat things" you can add (or not). The 0x and 4x are read/write - they have commands to read and to write The 1x and 3x are read-only - they only have read commands. Sure, the Modbus "authors" could have treated all points as read/write and just returned an exception response (or reject) if you try to write to read-only data. However, they chose to keep them separate so your app cannot even attempt to write to read-only data. Is that good or bad? It doesn't bother me. You'll also find that *MOST* slaves now allow all 0x data to also be read as packed 4x words, so that is also redundant & meant to simplify your access by giving you options. Regards Lynn August Linse, Senior Product Application Engineer 15353 Barranca Parkway, Lantronix Inc, Irvine CA 92618 [email protected] www.lantronix.com Tel: (949)300-6337 Fax: (949)453-7152
 
Well the 1x registers are for inputs only. 0x registers are for outputs, but can be used either way. As far as the way the Johnson device converts it, I'm not sure. They are not mirrors of each other, and they are not really interchangeable. Of course you can code an output address as an input to verify if an output is on or not, but you cannot output to a 1x address. Modicon PLCs only allow your discrete inputs to come in as 1x bits or an entire word of inputs can come in as a 4x address. Also, you can only map your outputs to a 0x or 4x address. We just got done with a big mess with Modbus and a GE Modbus concentrator. Apparently the static config data resides in 4x registers, but the dynamic (live) data is in 3x registers. With a Modicon PLC and the XMIT instruction, I can poll those 3x registers serially. But this application is across ethernet, and you can't poll anything other than 4x registers with the Modbus MSTR instruction. Let me know if you need more help, I'd be happy to help.

CK
 
A

Alex Pavloff

You see, the controller used by my company gets its protocol converted to Modbus via a Modbus Gateway. On some of our site locations, the Gateway is run into a Johnson's Metasys Integrator. The Gateway designates all the digital I/O has a 1X. However, the integrator from Johnson Controls uses 0X and 1X addresses. Everything works fine, but how is it that 0X and 1X addresses are interchangeable? Wouldn't this defeat the purpose of having 2 digital address types? If the 0X and 1X addresses are mirrors of each other, why the redundancy? Why not? :) There's nothing that says that 0x address have to be this... 1x addresses have to be this... it just that you can't write to 0x or 3x registers. Modbus is just showing is roots in the Modicon PLC. Implementers of the Modbus protocol are free to do whatever they want. Second, what other documents would you recommend for help with understanding Modbus? You've got the document that should help you if you're writing your own protocol. I would also recommend that you get the document on Modbus TCP -- even if you're not going to use it, as much of the information relates to Modbus as a whole, not just Modbus TCP. The only things that I can say to be careful of are: 1) If you're using Modbus RTU, you sometimes have to play games to figure out how much of the packet to get. Modbus says that "3.5 characters times of no data" defines the end of a packet. Depending on your comm library, you may or may not be able to do this. You can, however, pull the packet in one little chunk at a time. It's not as elegant, but it works just as well. 2) Byte order -- Modbus is backwards from Intel. Word ordering for double words or floating point numbers -- who knows? Everyone does it differently because there wasn't a specification. Strings jammed into holding registers? Same thing. A plan of mine is to actually put together a better resource for Modbus that would answer the rest of your question and get this up on control.com somewhere to do with the plc archive also. I suppose I should get cracking, huh? Alex Pavloff Software Engineer Eason Technology
 
B

Blunier, Mark

> I know the four standard addresses 0X, 1X, 3X, & 4X, and their type > differences. This brings me to my question. > > You see, the controller used by my company gets its protocol > converted to Modbus via a Modbus Gateway. On some of our > site locations, the Gateway is run into a Johnson's Metasys > Integrator. The Gateway designates all the > digital I/O has a 1X. However, the integrator from Johnson > Controls uses 0X and 1X addresses. Everything works fine, > but how is it that 0X and 1X addresses are interchangeable? Modicon uses 1X registers for inputs, and 0X registers for outputs and internal flags (coil that aren't mapped to any I/O). A Modicon PLC program will not allow you use a 1X register as a coil (at least not with Modsoft). If the integrator is mapping the I/O to 1X registers, everything should work, importing data. I'd guess that trying to map the other way, you'd have a problem using Modicon equipment, as you couldn't write to a 1X coil. With another one of your integrators, you might be able to do it. > Wouldn't this defeat the > purpose of having > 2 digital address types? Yes. > If the 0X and 1X addresses are > mirrors of each > other, why the redundancy? They aren't mirrors. > Second, what other documents would you recommend for help with > understanding Modbus? I'd recomend you get a small Modicon plc and the software to program it. If you understand how the Modicon I/O and registers work in the plc the Modbus protocal is not a hard concept to grasp. Mark Any opinions expressed in this message are not necessarily those of the company.
 
It might be because there are two address fields in Modbus, data type field(01, 02, etc) and the offset field(0-999xx). This offset field can be used to send addresses up to the limit of the machine's address field and is commonly used for this purpose for non-Modicon machines whose register address schemes do not match up with Modicon's. These machines only deal the offset field. For this example for a machine that has a limit of 99999, 0-09999 in the offset field can be used as an address for outputs and 10000-19999 for inputs and so on for other data types. Bill Mostia =========================================== William(Bill) L. Mostia, Jr. PE Independent I &E Consultant WLM Engineering Co. P.O. Box 1129 Kemah, TX 77565 [email protected] 281-334-3169 These opinions are my own and are offered on the basis of Caveat Emptor.
 
D

Darold Woodward

My company manufactures a "communications processor" that has a similar purpose as the types of devices you are discussing. We have similar redundant mapping of data into more than one type of Modbus register. The reason is that some masters are limited on the types of Modbus commands that they can send. It is easier for us to map the data in multiple ways than argue over which commands masters must support. Use the mapping that is most convenient for your Modbus master device. Darold Woodward PE SEL Inc. [email protected]
 
G

Grant Macdonald

Alex, I would be so pleased if you could come up with some sort of document that explains all of this a little better as well. Grant.
 
Top