Jump to content

Recommended Posts

  • MVP 2023

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.

Link to comment
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?

Link to comment
Share on other sites

  • MVP 2023

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

Link to comment
Share on other sites

  • MVP 2023
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.

Link to comment
Share on other sites

  • MVP 2023
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.

Link to comment
Share on other sites

  • MVP 2023

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.

Link to comment
Share on other sites

  • MVP 2023
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.

Link to comment
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.

Link to comment
Share on other sites

  • MVP 2023

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.

Link to comment
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

Link to comment
Share on other sites

  • MVP 2023

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.

Link to comment
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?!

Link to comment
Share on other sites

  • MVP 2023

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.

Link to comment
Share on other sites

  • MVP 2023
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.