Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
When using Modbus over TCP we discovered that coils could not be set. I found some bugs in the way that the code was creating the frame for setting single coils and single registers. I'm putting the fixed modbus.lua into my repository, it can be used if anybody else if having trouble with coils or single registers. I suggest that the dev team take a look at the changes and consider pushing it into a new release.
Thanks,
Jason
Hello Jason
That sounds nice for me.
Could you share your revised file to me, please?
I uploaded the file to my repository on the old twc.thingworx.com platform. I can no longer log in to that platform and I cannot find where my repository would have been migrated to on this new platform. I am unable to find the revised file on my local computer so we might be out of luck. My hope is that my revised changes made it into the latest releases but I'm not sure if this is the case. Maybe someone from thingworx support can help with this?
Hi Jason
We too had issues with coils in the Modbus implementation. It doesn't seem to have been fixed in source yet.
Would you be prepared to share the updated Modbus.lua file with me too?
Thanks,
Patrick
Is there any specific error with the coil? Are you using a similar structure on your modbus template like the following to get them?
properties.Test = {key="coil/9/61?format=Uint16", handler="modbus_handler", basetype="NUMBER"}
Hi Aanjan
I don't have the config. to hand but I suspect we used the same format as provided in the modbus_example.lua file.
One of my guys searched out docs, KB and community posts and didn't find any further instruction - beyond that given in the example files.
Thanks,
Pat
Dear Aanjan
Could you provide the download link for the updated modbus package ?
I downloaded it from the link you mentioned in the following article.
https://community.thingworx.com/message/2618#2618
But it seems this module is old one.
I am having trouble to start up the modbus module and want to try the latest modbus package.
Your prompt response would be greatly appreciated.
Thank you,
Kunio
Kunio, I don't believe we have any updated Modbus module, just the same one available in the Edge Help Center. Are you stuck on any specific issue?
Unfortunately the file was in my repository which appears to be missing now that the community site has been upgraded. I compared the latest modbus file provided by TW with the latest I have and it appears my changes have been merged.
Thanks all for the responses. We will check for the updates to the Modbus_handler.lua relating to the coils.
We have used Kepware products for years and years, which are great, and allow you to use the ThingWorx OPC DA SDK for connectivity instead. They are, however, quite an expensive license cost per node. This makes it very costly to scale out for many assets.
Hi all, I have done some digging around and manage to get Modbus working. It's workaround for the coils and discrete inputs, but it's let you to read them and also control coil. It's using Uin16 format except of bits, then be aware, when implemented in TWX, not true/false is shown, but 0/1. And same is with entry. This also allows you to change holding registers. Please feel free to try attached example and let me know id is working for you: https://onedrive.live.com/redir?resid=164BA8CE410AFBB!640&authkey=!AI_pwRLziipDdv8&ithint=file%2czip
All is based on localhost connections, then don't forget to change as your application require.