Author Topic: ModbusRTU Major bug? Please help :(  (Read 6620 times)

fohdeesha

  • Newbie
  • *
  • Posts: 46
    • View Profile
ModbusRTU Major bug? Please help :(
« on: August 08, 2014, 07:19:20 PM »
So I'm starting a project using AdvancedHMI for the interface with a Click PLC, and for being the only truly free HMI software I could find, it's awesome.

Using the RTU driver to talk to the click, the connection works fine. I have AdvancedHMI successfully displaying an integer register (modbus address 400001) on a digital panel meter with no problems.

However the problems arise the second I try to read/write any other type of register, namely single bits (coils). I have several simple coils I'd like to read the status of and display as a light, but AdvancedHMI refuses to do it. The light is stuck on no matter what coil address I put in there (until I put it in a bogus address then it does nothing). For instance output 1 on the Click is modbus address 8194, and the read function code is a 01. I saw the post where you showed the code that chooses what function codes to use, and to make it use a read code of 01, I need to begin the modbus address with 0. So I've also tried 08194. But absolutely nothing works. Even putting in input address such as 100001 still results in it not properly reading them. The same happens when I try to write to coils that support being written to.

I found a couple sparse posts on this forum with people having the same problem, namely this post ( http://advancedhmi.com/forum/index.php?topic=320.msg1393#msg1393 ) where a user has discovered that for coils and such, advanced hmi is sending out 10 byte commands, when it should be 8? No matter what I do, it WILL NOT read or write to single bits. Please help! If there's anything I can do to help please let me know, this hobby project is dead in the water until I can do this or somehow find another HMI software that's actually free. Thanks so much! I promise to buy all the button/meter packs : )

Also a question I have, instead of using static code to use the first digit in the modbus address to decide what function code to use, wouldn't it be easier to allow us to enter the function code directly ourselves in front of the modbus address? I'd imagine the way it's doing it now severely limits compatibility. For instance the click plc coils that support function code 01, 05, and 15 mostly begin with 8 (eg 8195), however to get that function code out of advancedhmi, it wants to see a zero in front of it correct? Holding registers on the Click begin with 1 (eg 16390), but they are simple coils so they want a read function code of 1. However if advancedhmi sees it begins with 1, it'll try to use the read code 02. Just a thought! It seems to be that while evaluating the first digit in the modbus address to determine function code, it doesn't strip it away, so it still uses that entire number string as a modbus address
« Last Edit: August 08, 2014, 07:22:38 PM by fohdeesha »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ModbusRTU Major bug? Please help :(
« Reply #1 on: August 08, 2014, 08:08:36 PM »
This bug has been addressed and a fix will be included in the next release.

As for the first didgit/function code, that addressing technique was chosen because of its common use. I personally find it to not make much since because the first digit doesn't always coincide with the function code number.

fohdeesha

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: ModbusRTU Major bug? Please help :(
« Reply #2 on: August 08, 2014, 08:18:47 PM »
This bug has been addressed and a fix will be included in the next release.

As for the first didgit/function code, that addressing technique was chosen because of its common use. I personally find it to not make much since because the first digit doesn't always coincide with the function code number.

That's awesome Archie! Thanks so much for the quick response. Is there any way I can help test this version ahead of time, or do you have a guess as to when it will be publicly available? I'm really itching to get this HMI installed :)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ModbusRTU Major bug? Please help :(
« Reply #3 on: August 19, 2014, 09:16:05 PM »
A new version (verison 3.64) has been posted with a fix to the ModbusRTU driver. Try this version and see if it is any closer.

fohdeesha

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: ModbusRTU Major bug? Please help :(
« Reply #4 on: August 22, 2014, 03:51:56 AM »
A new version (verison 3.64) has been posted with a fix to the ModbusRTU driver. Try this version and see if it is any closer.

Thanks so much for looking into this! Sadly I just downloaded the new version, and I'm still having the same issue. I can successfully read integer addresses and display them, but I cannot read/write the status of bits. if I use a light indicator, it displays on no matter what the actual bit is doing :(

I checked to make sure it wasn't just an off by one error or something simple, but no matter what it won't work

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ModbusRTU Major bug? Please help :(
« Reply #5 on: August 22, 2014, 03:55:07 AM »
I have a fix to reading inputs, for example address 10001 (function code 2). I will post it later today.

fohdeesha

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: ModbusRTU Major bug? Please help :(
« Reply #6 on: August 22, 2014, 06:14:49 AM »
I have a fix to reading inputs, for example address 10001 (function code 2). I will post it later today.

Well I'm reading simple store bits and output bits that use read code 01, for instance 08194. I work from home and have a modbus rtu plc sitting next to me at all times so I'm available for any rtu testing if you need, I'd love to test any fixes as soon as you can send them over! fohdeesha@gmail.com

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ModbusRTU Major bug? Please help :(
« Reply #7 on: August 22, 2014, 08:04:53 AM »
Version 3.65 is now posted.

I appreciate the testing and feedback

fohdeesha

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: ModbusRTU Major bug? Please help :(
« Reply #8 on: August 22, 2014, 08:59:59 AM »
Version 3.65 is now posted.

I appreciate the testing and feedback

That was quick! Upsides and downsides:

Just tested - reading of ALL register types now works great! I can successfully read integers, holding bits, and input bits (and output bits of course as they use the same function codes as holding bits). The Automation direct PLC's input registers all begin with 1 (eg 100006) so that automatically gets us the 02 read function code we need to work properly right off the bat.

However the click PLC's holding bits and output bits all begin with weird numbers (eg 8194 for output 2 or 16385 for holding bit C1). Simply adding a zero in front of these numbers when using them in AdvancedHMI works exactly as expected, and gets us the proper function codes. EG: 08194 in advanced HMI will read the output bit located at 8194 with read function code 01 (as advancedhmi uses the function codes 01 read and 05 write when it sees addresses beginning with zero). I'm sure you know all this but just making sure to be verbose in case any other lost RTU users are following this thread : )

Now the bad news: Reading any kind of address is working great, but I simply cannot get advancedhmi to write to any bits at all. No matter what I do it just does nothing, like the plc isn't even seeing any requests coming in or the requests are seeing the wrong function code. I tested writing to holding bits and outputs bits that support being written to, and it just won't happen. I tested toggle switches, momentary set switches, write value switches, etc. Just doesn't do anything. But it reads all of these same bits just fine.

Thanks so much for making some headway on this! I will definitely be purchasing your button/meter packs later tonight. Let me know if there's anything else I can help with

edit: I'm sure you've seen, but this guy posted some code modifications that may fix the writing of coils (function code 05)? - http://advancedhmi.com/forum/index.php?topic=403.0
« Last Edit: August 22, 2014, 09:55:12 AM by fohdeesha »