Jump to content

Modbus TCP / IP - No conexion


Recommended Posts

Hello Unitronics support.

Iam currently working with an PLC Samba in a program for communication modbus with an IO-Link card with Ehternet communication.
But I not can set the plc as master in the network.
In the program I used the block MODBUS IP read holding register for read the address target in the IO-Link device. But the block shows in the status messages when is started the number 5, which means that it has no response from the IO-Link device.
I attached the program in this email so you can see if I have any errors in the programming.

The PLC Unitronics samba have the device feactures detailed below: 
Unitronics samba
OPLC Information:    
Model: SM70-J-TA22
Hardware Rev: B
OS Version: O/S: 4.11 (28)

I check the devices by Modbus poll and obtain the data detailed below:
Data etherNET/IP IO-Link master Baumer // PN: 11215460. 
Seting comunication:
Comunication: Modbus TCP/IP
Ip: 0192.168.0.250 (IPv4)
Repose Timeout: 1000 ms
Delay Between polls: 1000 ms
Server port: 502
Connect timeout: 3000 ms

Data:
Slave ID: 1
Data sensor 1: 41000 (Status sensor), 41001(Empty), 41002(Mesurment), 41003(data switch).
Slave ID: 2
Data sensor 1: 42000 (Status sensor), 42001(Empty), 42002(Mesurment), 42003(data switch).
Slave ID: 3
Data sensor 1: 43000 (Status sensor), 43001(Empty), 43002(Mesurment), 43003(data switch).
Slave ID: 4
Data sensor 1: 44000 (Status sensor), 43001(Empty), 44002(Mesurment), 44003(data switch).

if you have any suggestion please tell me for can solution this problem.

I wait attentively for your reply.

Kindest regards.

2023-12-13 Modbus master.vlp

Link to comment
Share on other sites

Hi Flex, thanks for answer. I also work with Luis and Facundo who have made some questions.

This is the situation>

  1. The program Luis posted if we use the socket 3 for Modbus configuration, when we open the configuration socket option into that block, Socket 3 indicates "socket 3 Deafaulkt TCP(20257) Slave
    1. as you can see if we put that option, socket 3 / it should work as salve, and we need to be master.
    2. Same situation for socket 2, it appears to be set as slave at the end of the sentence. 
      1. Sockets 0 and 1 we understand it is not useful for our application. 
      2. Capturadepantalla2023-12-14alas10_06_25.thumb.png.ae5c363fd3141c97ffe483a4800571f4.png

 

  1. Note that we at the TCP/IP Socket init block, we already at option "cliente/Server" we already set it as Client/Master.
    1. Is it ok for you?
  2. image.thumb.png.c4fac2394a22313c725db59769f1d9dc.png
  3. Is this configuration enough or correct?
    1. Which socket should we use, if we see that this options do not set it as Master?
  4. About Modbus IP read holding register
    1. Can you see why it has not answer if the slave is ok and available at the network? (we tested the IO Link master device (as slave confirmed) communication with modbus poll and works fine). 

We really appreciate your answer and time.

Regards

Santiago.

 

 

 

 

 

Link to comment
Share on other sites

  • MVP 2023
40 minutes ago, Santiago PB said:

1. as you can see if we put that option, socket 3 / it should work as salve, and we need to be master.

The Socket Initialization FB determines master or slave. Ignore the "Default:" statement in the MODBUS configuration FB. It is true that is the default, but the Socket Initialization overrides.

43 minutes ago, Santiago PB said:

3. Is this configuration enough or correct?

  1. Which socket should we use, if we see that this options do not set it as Master?

 

You can use any of the 4 sockets for any purpose. Just initialize them the way you want them. It's best not to have two or more sockets set to the same port number.

47 minutes ago, Santiago PB said:

4. About Modbus IP read holding register

  1. Can you see why it has not answer if the slave is ok and available at the network? (we tested the IO Link master device (as slave confirmed) communication with modbus poll and works fine). 

 

As I said, you appear to be using Socket 3 for your comms, but you are configuring your MODBUS to use socket 2. Change the MODBUS configuration to socket 3. And again, ignore the "Default:" statement that appears there, just choose the correct socket number.

Link to comment
Share on other sites

  • MVP 2023

Multiple problems:

1) Get rid of ladder rung 2. The SCAN_EX FB is for when the PLC is the slave.

2) With MODBUS you need to CONNECT to the slave device. Check the example projects that came with your VisiLogic installation to see the proper procedure for performing the connect function.

3) It looks like your vector that receives the data, starting at MI 12, is of length 4 yet you do not have 3 additional unassigned MIs for the data to go without overwriting MI 15.

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.