Author Topic: DOUBLE WORD - WAGO PLC Modbus TCP  (Read 5388 times)

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
DOUBLE WORD - WAGO PLC Modbus TCP
« on: February 02, 2015, 10:37:22 PM »
Dear all,

Does anyone know how to handle DOUBLE WORD (%MD)?
I am using version AHMI 3.97e and WAGO 750-881.
I am able to communicate + read & write data between WAGO and AHMI.

However, when using %MD, unexpected result occurs.
It will show very large data, described in the following scenario:

I modify value of %MD1200 = 1
Then, in AHMI, the value is showing 16256 at address 414690.
I expect to get 1 in AHMI, which is the case when I modify %MW1000 = 1
In AHMI, the value is showing 1 at address 413289.

Please refer to attachment for more details.
Thank you.


Best regards,
Andrew

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5324
    • View Profile
    • AdvancedHMI
Re: DOUBLE WORD - WAGO PLC Modbus TCP
« Reply #1 on: February 03, 2015, 03:10:31 AM »
When using a double word, you have to put an L in front of the address. Try L414690

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: DOUBLE WORD - WAGO PLC Modbus TCP
« Reply #2 on: February 03, 2015, 03:17:42 AM »
When using a double word, you have to put an L in front of the address. Try L414690

Try that and doesn't work. It's still showing 16256.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5324
    • View Profile
    • AdvancedHMI
Re: DOUBLE WORD - WAGO PLC Modbus TCP
« Reply #3 on: February 03, 2015, 03:37:52 AM »
This is just a guess, but in CodeSys, the addresses are designated in byte offset, but Modbus uses word offset. So if MW1000=413289, then would MD1200 be this?

413289 + 100 (words) = L413389

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: DOUBLE WORD - WAGO PLC Modbus TCP
« Reply #4 on: February 03, 2015, 10:00:22 PM »
Hi Archie,

I think it is uncommon to use %MD in modbus.
So, it should be converted to %MW internally in PLC before going to modbus.
Sorry for the mess.


Best regards,
Andrew


surukai

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: DOUBLE WORD - WAGO PLC Modbus TCP
« Reply #5 on: March 24, 2017, 09:13:40 AM »
Sorry for necromancy but I thought I'd give a proper answer to the question

Since I implemented Modbus TCP in our library recently I can help

%MDx is located at 0x3000+x*2 and 0x3000+x*2+1 

0x3000 (or 12288 in decimal) is the offset for "M" area registers. That means MW100 is on address 12388.   MD100 is located on 12488 and 12489.

Hope that helps. Also make sure to be consistent with endianess so you don't swap the two words around. 

/Surukai