Member Login
member
passwd
remember me on
this computer.

- join now -
- forgot username or password? -

Jump to a Date

Sponsored Communities
Cool stuff
Select a topic of interest:
...and press:
Neat Stuff
Control.com Stuff

Visit our shop for nerds in control lifestyle products.

Fortune
"I don't believe in astrology. But then I'm an Aquarius, and Aquarians
don't believe in astrology."
-- James R. F. Quirk
RSS Feed
RSS feed Use this link to get an RSS feed of the Control.com article flow, for private, non-commercial use only:
www.control.com/rss/
To get a personalized feed, become a member at no cost.
Select a Page Style
Select one of the following styles:
- BluFu
- Classic
(cookies required)
advertisement
from the Forum department...
micrologix 1400 and modbus rtu woes.
Communications systems and equipment. topic
Posted by blackj on 19 May, 2009 - 4:26 pm
I need to communicate with a micrologix 1400. When i attempt to do so, I get error code 3.

I am new to modbus messaging and haven't had alot of experience with it, so thank you in advance for any help you can give me.

I am trying to poll 1 analog value in register 40001.

Comms are at 9600, 8N1.

Byte order is Bigendian, type is r4 (is this correct for the micrologix 1400?) As for the request, im using function code 3 with a byte length of 2.

Modbus rtu message that goes out to the device is:
01 03 9C 41 00 01 FA 4E

response from device is:
01 83 03 01 31

any help would be appreciated.


Posted by Jerry Miille on 19 May, 2009 - 8:50 pm
The response you are getting is an error response (the most significant bit of the function code is ON), that is your transmitted function code was a hex 03 and the response function code is a hex 83. The following byte is the error code and it is 03 hex that means a data value is incorrect. That is not exactly correct because it is the address that is incorrect. You are asking for register 40001 but the 40000 part of this address is implied by the function code (03 Read Holding Registers).

Just change your address to 1 and you should be good to go!

Jerry Miille

Miille Applied Research Co., Inc.
http://www.miille.com/


Posted by Harvard on 19 May, 2009 - 9:26 pm
Modicon Register 40001 is Modbus Register 0.
The correct poll is:
01 03 00 00 00 02 C4 0B


Posted by M Griffin on 20 May, 2009 - 1:21 am
Is the register really 40001, or is it actually holding register 1? Some people like to use numeric prefixes to indicate the address type, where "4" stands for holding register. It's like using "I" for inputs and "Q" for outputs on IEC style PLCs.

The prefix isn't actually part of the address though. It also isn't actually part of Modbus as there is nothing in the specification that allows it. It's just something that some people unfortunately like to do when writing documentation, and it has probably caused more confusion than anything else.

An exception code of "3" should indicate an incorrect number of registers. However, you are only asking for 1 register. I suspect that the AB PLC is returning an incorrect error code where it should be returning a "2" for an address error.

With Modbus, the type of register is selected by using the correct function code, and function code 3 is for reading holding registers. I would suggest trying it again with register address 1 instead of 40001.


Posted by blackj on 20 May, 2009 - 10:14 am
Thank you all for the help! That was the problem.


Posted by M Griffin on 20 May, 2009 - 11:20 am
One other point to add to this is the register may be "0" rather than "1". According to the Modbus protocol, the first register is register "0". However, some people like to call the first register "1".

What this means is that you may need either register "0" or register "1" depending upon whether the documentation follows the numbering system used by the Modbus protocol, or whether someone just happened to prefer counting from "1".

Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2009 Nerds in Control, LLC. All rights reserved.

Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.

Advertisement
Our Advertisers
Help keep our servers running...
Patronize our advertisers!