Jump to content

Recommended Posts

Yes. There are example projects that came with your VisiLogic installation and there are YouTube tutorials and webinars available. Review those and make an attempt at what you're trying to do. If you still have difficulty or questions, drop back by and someone will help you.

Share this post


Link to post
Share on other sites

Thanks a lot,

I already watch and read that.

I mean to enable both communication PC access and Modbus TCP communication at the same time.

Modbus slave is on Unitronics PLC and Master on Siemens PLC.

On start-up bit I set PLC NAME and TCP CARD INIT.

For Unitronics, as I understand I should use Socket 3 for non-unitronics PLC in Fb MODBUS_IP CONFIG. Right? Can I use Socket 2?

What I should to put in other parameters especially to Network ID, and how to populate Slaves table?

Share this post


Link to post
Share on other sites

Yes, you have 4 sockets available to you for Ethernet communication in the Vision line of PLCs (8 if you are using a V700). Simply initialize any sockets you wish to use if you want the sockets to be a protocol or port number different than the default.

Here is the default (available in the Help file):

image.png.ba9b2cfa75b453d1f3de133dd013b928.png

Share this post


Link to post
Share on other sites
11 minutes ago, Milosh said:

For Unitronics, as I understand I should use Socket 3 for non-unitronics PLC in Fb MODBUS_IP CONFIG. Right? Can I use Socket 2?

You can use any socket for any purpose. Those are just the defaults, but don't inadvertently assign the same port number to two different sockets.

Share this post


Link to post
Share on other sites
9 minutes ago, Milosh said:

What I should to put in other parameters especially to Network ID, and how to populate Slaves table?

Network ID is usually not important for TCP (but may depend on what device you're communicating with). The slaves table is only needed if the PLC is the master.

Share this post


Link to post
Share on other sites

So I need to do call for two TCP/IP SOCKET (Socket 1 and Socket 3) and than call MODBUS_IP_CONFIG (Socket 3)?

Or I need just to use TCP/IP SOCKET (Socket 1) and MODBUS_IP_CONFIG (Socket 3)

Share this post


Link to post
Share on other sites

Not sure I understand your question. You must use a socket initialization FB anytime you wish to assign a different configuration to the socket than the default assignment. Many programmers initialize all the sockets anyway just to have visibility into each socket's assignment and to help make sure there is no duplication of port numbers.

Any socket that will be used for MODBUS communications (whether master or slave) must also have a MODBUS configuration FB. All the initializations, configurations, etc, should be activated by SB 2.

Share this post


Link to post
Share on other sites

Don't forget that you also need a Scan_EX FB for the MODBUS slave and addressing from the Siemens PLC will likely be "off by one" since Unitronics addressing starts at address zero and MODBUS addressing starts at one.

Share this post


Link to post
Share on other sites

I use configuration like attached. 

I have online connection with PLC via VPN.

I change Network ID for modbus_ip_config block. After that I can't connect to plc :(

I can ping but cannot connect to it anymore.

01_mdbs.PNG

02_mdbs.PNG

Share this post


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

I change Network ID for modbus_ip_config block. After that I can't connect to plc

Can you explain this in more detail? Where did you change Network ID? From what to what? What are you using to connect to the PLC? Are you within the local network or outside? All these details are important.

Share this post


Link to post
Share on other sites

Sorry I have parrallel contact with SB2. When I was online I changed Network ID, and than Set that Contact. After it I lost connection...

 

Share this post


Link to post
Share on other sites
8 hours ago, Milosh said:

When I was online I changed Network ID

Exactly where and how did you do this. Also, please answer my other questions if you want help.

Share this post


Link to post
Share on other sites

Sorry, I change Network ID in MODBUS_IP_CONFIG from number 255 to number 1. 

I am outside from the local network, connected via VPN, and to Unitronics ethernet card.

I put parallel contac with SB2, and set it. After taht can not establish connection. I can ping PLC but can't go online.

Share this post


Link to post
Share on other sites

What are your connection settings in VisiLogic? I recommend that you be local to the PLC when trying to set up and troubleshoot communications.

Communications between VisiLogic and the PLC do not use MODBUS. The MODBUS settings should have no effect on your connection using VisiLogic unless you are stepping on port 20256 inadvertently.

Share this post


Link to post
Share on other sites

When you're local you can connect to it with a USB or serial cable and avoid all the Ethernet issues. That makes troubleshooting much easier.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks a lot. I tried localy and everithing works great.

What is the general practice for realizing MODBUS TCP?

What if I have to do multiple read/write to several devices? 

At the same time to send request for read/write is not possible as I know? So the sequencing is the key.

Possibly solutions:

1. Realize read / write for several devices in sequence. 1. read 1st dev -> 2. write 1st device -> 3. read 2nd device etc.

2. Realize read for several devices in sequence. Write will be done on request. Sample: 1. read 1st -> read 2nd -> read 3rd -> write request for 6th device generated -> stop reading -> write to 6th device -> read 4th -> read 5th

Share this post


Link to post
Share on other sites

Unless you're using a V700, the most devices you can communicate with by MODBUS TCP is 4 (without socket sharing, which I won't get into here). Yes, if your data exchange ladder rungs are set up properly you can communicate with up to 4 devices simultaneously.

image.thumb.png.9f0697b84d57b2833cde9da8a6d9288b.png

I'm just showing 2 of the 4 here. Just make sure your timer is long enough to make it through all 4 devices you're communicating with. If you're both reading AND writing to non-Unitronics devices, I would do it a bit differently. Instead of the timer Setting the comm requests, I would have the timer toggle another bit and use a positive transition of the bit to initiate all the reads and a negative transition to initiate all the writes.

If you're communicating with other Unitronics PLCs, there is a handy Read/Write Mixed Data FB that will do both the reads and writes in one operation.

Share this post


Link to post
Share on other sites

Great...

Thanks a lot for explanation.

When you say all the reads and all writes, you mean for 4 device or more?!

What if we need read/write from different locations addresses which is not in seqence? Can we call more RHR whit different addresses in one requst?

And what is the situation with MODBUS RTU, is the rule same as here or sequencing is required?!

Share this post


Link to post
Share on other sites

Only one Modbus conversation can be active at a time, but if you have both a serial (Modbus RTU) and an Ethernet connection (Modbus TCP) you can treat them separately.

1 hour ago, Milosh said:

Can we call more RHR whit different addresses in one requst?

Go back and read Flex's response - look at the Help on the Read/Write Mixed Data block.  THIS ONLY WORKS WITH UNITRONICS PLCs!  If you are talking Modbus to something other than a Unitronics PLC then ignore this block and suggestion.

I'm getting the impression from reading your post that you may be thinking faster than you're coding and testing.  Try adding one Modbus read at a time to your sequence and see how it works.  Also add a little "cool down" time between reads to allow the port to breathe.  If you're using Modbus TCP, allow about 0.25 seconds between operations.  You can speed it up later if everything works.

Always post your PLC program if you have operational questions regarding Modbus.  There are so many things involved that simply posting screenshots will not give us what we need.

Joe T.

Share this post


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

What if we need read/write from different locations addresses which is not in seqence? Can we call more RHR whit different addresses in one requst?

Each interaction would be a different conversation. As Joe Tauser said, only one can be active at a time. Just as I said you would have to separate reads and writes, if you want multiple reads or writes, they are each separate conversations. Every MODBUS TCP interaction through a single socket must be dealt with independently.

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...