cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Modbus Driver

jasonpe
1-Newbie

Modbus Driver

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



11 REPLIES 11
anishi
13-Aquamarine
(To:jasonpe)

Hello Jason

That sounds nice for me.

Could you share your revised file to me, please?

jasonpe
1-Newbie
(To:anishi)

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?

pnash
1-Newbie
(To:jasonpe)

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

Aanjan
9-Granite
(To:pnash)

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"}

pnash
1-Newbie
(To:Aanjan)

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

khorie
1-Newbie
(To:Aanjan)

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

Aanjan
9-Granite
(To:khorie)

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?

jasonpe
1-Newbie
(To:pnash)

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.

dbassolino
5-Regular Member
(To:jasonpe)

What about using a Kepware server?  Modbus Suite for KEPServerEX | Kepware

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.

Top Tags