News:

  • July 13, 2026, 10:55:49 PM

Login with username, password and session length

Author Topic: TCP/IP Modbus problem  (Read 52499 times)

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: TCP/IP Modbus problem
« Reply #15 on: February 07, 2014, 11:13:15 AM »
hoejinkim, you wrote, "I tried as you mentioned first, but it still didn't work (First picture)"

Your first picture would've caused the ECOM100 to do a Modbus Function Code 04 "Read Input Register" 1072. Input Register 1072 is sometimes commonly written as 31072, but not always. The value 1072 comes from your RX's parameter V2057. V2057 is an octal address. When you convert this octal address to decimal you get 1071, but you must add 1 because V0 = Register 1, therefore V2057 = 1072. The reason it did a Function Code 04 "Read Input Registers" instead of a Function Code 03 "Read Holding Registers" is because the 2nd LD instruction's parameter K129 is an odd number (not even).

Also, I don't know your software that you are using as a Modbus TCP/IP Slave, however, in the Variable Settings box you have selected "Input Registers" with an address of "41200". I don't know what that means. But if that is where you are looking, you are looking in the wrong place. The place that got read from your Modbus TCP Slave was Input Register 1072.

You wrote, "and i tried again by changing IR to Holding registers (but i don't understand offset 1072 value?)
but it didn't work.(Second and Third picture)"


Your second picture would've caused the ECOM100 to do a Modbus Function Code 04 "Read Input Register" 1072 again... the same as your first picture. But this time you have your Modbus TCP/IP Slave looking at Holding Register 1072 instead of Input Register 1072.

Your third picture, again, does a FC04 "Read Input Register" 1072. But this time you now have your Modbus TCP/IP Slave looking at Holding Register 41200.

The only iteration you didn't try was the one that would work. If you left your ladder logic the same and then set your Slave up to provide Input Register 1072, then it should work.

You wrote, "In the manual, 'ECOM100 does not support function code 4. Thus 30001 address ranges cannot be read from a server/slave device' So i think i need to change from IR to HR cause the funcion 03 has 'Read Holding Registers'"

I realize the manual tells you this, but it is incorrect. We at Host Engineering designed the ECOM100 and we made a change to the firmware that allows it to do a FC04 and to read 30001 address if you want it to. This change has never made it into the manual. However, in 2005, when this was implemented, I wrote an FAQ to explain how it works.

http://www.hosteng.com/FAQFiles/ECOM.htm#FAQ0064

You wrote, "In terms of HR, Do i have to write like this:
LD K410
LD K129
LDA O1400
RX V2057
and the address for Modbus TCP/IP slave would be 41200 right??"


No. To do Holding Registers your 2nd LD would have to be K128, not K129. Again, if the length parameter is an even number then FC03 "Read Holding Registers" will be done; if the length parameter is an odd number then FC04 "Read Input Registers" will be done.

Also, your RX's parameter (i.e. V2057) is what determines the address of the Register (whether it be Input Register or Holding Register).

2057 octal = 1071 decimal, add 1 = 1072.

You wrote, "I just found excel file which called 'Modbus Conversion' and easily calculated Address for Client and slave.
I got 41072 Holding Registers (HR), and 31072 Input registers, but i am not going to use Input registers.
but i tried again with new value of HR but it didn't work too.(first picture)"


Your ladder in this picture is the same, it is doing a FC04 "Read Input Register" 1072. Your Slave is set to provide Holding Register 41072.

You wrote, "From second picture, i touched this setup communication ports little bit, is there anything wrong?? does it affect communication?"

The setup dialog you have pulled up is for the serial port of your PLC, not the ECOM100.

Please try this:
LD K410
LD K129
LDA O1400
RX V2057

...and set your Modbus TCP/IP Slave software for "Input Registers", with "Address" set to 1072.
There are two types of people in the world; those that can extrapolate from incomplete data sets.

hoejinkim

  • Jr. Member
  • **
  • Posts: 10
Re: TCP/IP Modbus problem
« Reply #16 on: February 07, 2014, 04:22:06 PM »
Hello, Greg

this is results. still no communication...

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: TCP/IP Modbus problem
« Reply #17 on: February 07, 2014, 04:49:42 PM »
hoejinkim, please download Wireshark (http://www.wireshark.org), install it, and run a trace, save the trace into .PCAP file, and post that file here, or email it to me at support@hosteng.com.
There are two types of people in the world; those that can extrapolate from incomplete data sets.

hoejinkim

  • Jr. Member
  • **
  • Posts: 10
Re: TCP/IP Modbus problem
« Reply #18 on: February 07, 2014, 06:34:50 PM »
Hello, Greg.  i sent a file to this email address 'support@hosteng.com'

Thank you.

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: TCP/IP Modbus problem
« Reply #19 on: February 10, 2014, 03:28:22 PM »
hoejinkim, the Wireshark trace you sent only shows the master as being your Dell PC (169.254.54.15) sending various requests to the ECOM100 (169.254.77.203) using our HAP protocol over UDP.

In other words, there is nothing in the trace showing the ECOM100 sending Modbus TCP telegrams at all.

What you need to do is start Wireshark trace, and then trigger the ECOM100 in your ladders to execute the RX ladders we've been discussing. I am assuming that your Dell PC (with Wireshark) is the one that the ECOM100 is supposed to be sending Modbus TCP telegrams to, correct?
There are two types of people in the world; those that can extrapolate from incomplete data sets.

hoejinkim

  • Jr. Member
  • **
  • Posts: 10
Re: TCP/IP Modbus problem
« Reply #20 on: February 10, 2014, 04:58:20 PM »
Hello Greg

I captured it while the PLC (ladder logic) and Slave device are running. (i am not quite sure if i captured in correct). There were a lot of file types when i save a file.

Yes, ECOM100 needs to send a Modbus TCP telegrams to read a data from slave device.

I will capture again after i study Wireshark (if you let me know certain way to save it, i would be appreciate  )
and send you by email.

thanks

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: TCP/IP Modbus problem
« Reply #21 on: February 10, 2014, 05:50:28 PM »
Just save it into the .PCAP file. In Wireshark that's File --> Save As... (give it a name) and it will save it as a .PCAP file.
There are two types of people in the world; those that can extrapolate from incomplete data sets.