Jump to content
keklon

Modbus TCP/IP and 3rd party device Help

Recommended Posts

Hello, After 2 days of researching an trying , with no success, to setup a communication with a V130 and a C-More HMI via Modbus TCP/IP ,  Its time I ask for help.  Eventually I will need to connect 6  V130's  to the HMI but  I can't seem to get the first V130 to communicate.  As I read in some other topics , I will use to this Socket 3 ,port 502 as the C-More is a 3rd party device. I am using Socket 1 for the PC Programming port and it is communicating. Not sure to use The V130 as a slave or a master. I tried both ways to no avail. Attached is a copy of the project. I am hoping someone can point me in the right direction.  Also, I am pasting a screen shot of the C-more Com setup.  

image.png

OrSolder36_Dial_G1_DutyCycleModbusIP.vlp

Share this post


Link to post
Share on other sites

No doubt others will chime in soon as well.  For starters, a very quick look shows you have too much going on for initial testing, and a lot is incorrect with conflicting messages for the little minions running around inside the 130.

I suggest that you have another look  at the help file for Protocol FB, TCP/IP  and note the layout and sequencing of the ladder in the examples.  I'd also not be using 255 as your ID. 

Start again with something simple using the above as a guide.  Your intent is to simply find what works for comms to the HMI....nothing else.  Do an Init & Reset of the PLC after your first download of your new test program, before running it.  I would think that Master is going to be the one to use, but you have also said "Eventually I will need to connect 6  V130's  to the HMI" which is also potentially a problem as to what is in charge.  You'll likely need to only have one plc talking to the panel, and relaying info received from others. 

As an example of things that won't work, your net 4 has 2 direct conflicts that will always stop the rung getting to the end.  You have both an inverted and direct contact reference to the socket 2.  So if one is on the other isn't.

cheers, Aus.

 

Share this post


Link to post
Share on other sites

Thanks for the tips. Looking at Net 4, the two contacts in regards to Socket two, NO SB145 contact is for init and  the NC SB149  is  for connection. I can't see how this would not  complete flow to the Connect FB.  Can you be more specific?

 

Share this post


Link to post
Share on other sites

ooops, misread the descriptions, sorry.  Thought they were the same thing. 

I would still be going along the simple path I first described. 

Any time I am using something new, be it a physical gizmo or programming capability I am not familiar with, I always do it as a standalone trial to fully learn the intricacies of how it works.  Once that is done and fully into the brain and perhaps physical notes, only then will I integrate it into the developing program.

cheers, Aus

Share this post


Link to post
Share on other sites

 Before I attempt to transmit data from the V130 to  the C-More HMI,   I need to establish communication between the two.  TCP/IP is a hand shake protocol . Now using socket 3  ,P 502 and only being concerned with the TCP/IP Connect FB,  I've taken out the configure TCP/IP FB.   I am not able to to get SB150 to be active. I'm thinking that it may have to do with the PLC slave number. I have tried 0, 1  and even 255 as illustrated in the screen shot above. Looking at Automation Directs customer forum I see there are issues  with C-more and Modicon Modbus TCP/IP protocol .  Can anyone tell me how to determine the V130  slave number aside from guessing?  I  see the Set network ID FB  is there a set slave ID type  of FB?

Share this post


Link to post
Share on other sites

In the case of connecting a Unitronics PLC to an HMI via Modbus TCP, the PLC is a slave.   You've been going down the road of trying to set up as a master.

Slave mode is much easier - you don't have to connect and disconnect sockets in the PLC.  The C-More will handle reading from and writing to the PLC.  All you need in the PLC program is a SCAN_EX block to turn it into a slave after you've called the Modbus IP Config block.

I hacked your program up a bit.  Socket 2 defaults to port 502 TCP slave so you don't need to do anything.  You will need to read the Help on Modbus Slave addressing, and remember that Unitronics starts counting registers at 0, so to read an MI or an MB add 1 to the Modbus address; i.e. MI 10 in V130Land = Modbus 40011 or Holding register 11.

Download what I've attached, cycle power, and let us know if you have success communicating.

Then we can talk about making all those PID blocks you've defined work.

Joe T.

 

 

OrSolder36_Dial_G1_DutyCycleModbusIP_JT.vlp

Share this post


Link to post
Share on other sites
2 hours ago, Joe Tauser said:

In the case of connecting a Unitronics PLC to an HMI via Modbus TCP, the PLC is a slave. 

Sorry...my never doing this particular thing is showing suggesting Master.  Is slave a general rule you work by, Joe?   I am still used to working with dumb HMIs that were totally controlled by the plc.  I've just looked this unit up, it has far more brains.

I think I'll have to stop trying to be helpful if I haven't actually specifically done something.   😶

cheers, Aus

Share this post


Link to post
Share on other sites

Thanks for the unambiguous feedback Joe T.  I downloaded and ran the attached  still dont see SB 149 active for the connection.  I've done an initialize and reset command and even placed  TCP/IP initialize  FB  for the sockets 0 and 3 in case of overlap from my previous edits and still no connection. The  IP Address of the C-More is 192.168.0.10 and I entered this in the Modbus Config FB in the column where the slaves are listed. Unsure if this is correct? I understand that the  C-more acts as the master in this scheme . Can you take a look and see where else may be causing connection issues?

OrSolder36_Dial_G1_DutyCycleModbusIP_JT.vlp

Share this post


Link to post
Share on other sites

 The Data is there. After I did a raw send and made tags on the Master side the connection is now working. Thanks for all the help. 

Merry Christmas and Happy New Year To All.

 

Share this post


Link to post
Share on other sites

Hello All,

I have 6  V130 's as slaves connected Modbus IP reporting to a C-more HMI as the master. Each V130 sends a vector of 6 MI's to the HMI reporting temperatures from T/C's on heaters. This is working flawless.  My next step is to also send some Data from MB's.  I am uncertain of best way to do this.  Would it be wise to add one more MI to my vector and  use Store Direct  for the desired MB as  a BCD value?  How do I convert the MB's to MI's  for Modbus IP?

Share this post


Link to post
Share on other sites
7 hours ago, keklon said:

Would it be wise to add one more MI to my vector and  use Store Direct  for the desired MB as  a BCD value?  How do I convert the MB's to MI's  for Modbus IP?

That is the best way to do it. Function that packs bits into registers is called "Struct", you can find it in "Vector" tab.

Share this post


Link to post
Share on other sites

Isakovic is correct.  The one thing to remember when using Structs is to ensure that you aren't inadvertently using an area of the vector the struct uses to "make" itself.  This varies with what you are actually composing the struct from.

cheers, Aus

Share this post


Link to post
Share on other sites
On 1/9/2020 at 8:20 AM, Ausman said:

you aren't inadvertently using an area of the vector the struct uses to "make" itself.

Thanks Keklon, I forgot to say that I manually enter a description into the largest vector the struct will make, to ensure I don't go near it with other things.  Visilogic does not do this automatically, hence my earlier advice.  Something like "Unit and Struct number and direction" copied down in all the Descriptions.

Structs can get terribly confusing if you don't keep track of source and destination very well.  Excel is your friend.

cheers, Aus

1.gif.1b72a0bd9aed79db73967fdee3193cb3.gif

Share this post


Link to post
Share on other sites

  

On 1/10/2020 at 4:30 PM, Ausman said:

Visilogic does not do this automatically, hence my earlier advice.  Something like "Unit and Struct number and direction" copied down in all the Descriptions.

 

Everyone should know about this feature and use it.

image.thumb.png.bdcacce8b58fa3a991c39e20bc6de2a7.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...