Jump to content

i need connect modbus TCP/IP


Recommended Posts

When communicating over an Ethernet network you will first need to ensure that each device has a unique IP address. All of the slave devices should have a different IP address or the V130, or any other devices will not be able to differentiate from one device from another.

 

We do have example programs for Modbus IP for both master and slave configurations. These can be found within our VisiLogic software by navigating to the help menu and selecting Examples.

 

As the Modbus IP master you will follow the sequence listed below:

  1. Connect to the slave device using the required IP address and port
  2. Send the required Modbus commands
  3. Disconnect from the slave device
  4. (Optional) Connect to another slave and repeat steps 1-3

Please note: Our Ethernet cards have 4 sockets (Ethernet port configurations) that can all be used simultaneously.

Link to comment
Share on other sites

Hello,

 

Thank you for using our Unitronics Forum.

 

We have example projects of how to configure Modbus communications over Ethernet in the help menu of VisiLogic.

Please navigate to the help tab> Examples...>Version 900> Project Examples> Communications> Ethernet> Ethernet MODBUS IP

 

In this folder, you will find example programs for Modbus Master and Slave configurations.

 

Also, we have a webinar full explaining these set-ups with our software on our Webinars page under the support tab:

http://www.unitronics.com/support/webinars/modbus

Link to comment
Share on other sites

Hello,

 

In order to connect to the 4 slave units, you must connect over different sockets, or connect to them 1 at a time with socket 0 and disconnect when you are done communicating to each slave.

 

In your second picture I noticed you have 4 socket 0 connect blocks; you must use different sockets and initialize the sockets.  The sockets we have in VisiLogic are Socket 0 (which you have used), Socket 1, Socket 2 and Socket 3.  Please configure these and connect them with an assigned slave IP for each of them.

Link to comment
Share on other sites

You can connect to one IP address at a time with a single socket.  This is similar to your power outlet: for a single power socket, you can only plug in one device at a time. 

 

For example, your computer is plugged in now, so you cannot plug anything else in.  You must remove your computer's power cord to plug in another device like your TV.

Link to comment
Share on other sites

  • MVP 2023

Just to make sure it's clear: You have two choices when communicating with four other devices over Ethernet. You may either: 1) connect to all four simultaneously using four different sockets, or 2) connect to each device sequentially using a single socket, connecting and disconnecting each time you transfer data.

 

For #1 you will have separate ladder rungs with four Socket Initialization function blocks, four Configuration function blocks, four Connect function blocks, and four Read and/or Write function blocks.

 

For #2, you will only have one of each, but the IP address must be indirect (using 4 MIs). You must load the IP address into the MIs, execute the Configuration block, execute the Connect, do the Read/Write, then disconnect and repeat for each of the remaining three devices.

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.