Jump to content

V700 Modbus TCP Master connect to Danfos ECL and VTS ventilation device


Recommended Posts

Hi,

I create my first project with Modbus TCP and V700. I need V700 as Modbus TCP Master and 3 Modbus TCP slave devices. Mostly I need read different parameters from these devices, rarely to make changes.  I need start advice's for me and and answer on some stupid questions :)

1. I know that v700 has 8 sockets. Can I use 3 of them and configure each of these 3 sockets to work with 502 port for communication for 3 different IP slave devices independently? Or have better organize socket usage?

2.  In my very start example (I took from examples one variant to begin work with) I want to read 11201 holding register from 192.168.1.54 device. For now start and stop communication manually.  I can't establish connection. Can you please look what is wrong?

BR, Alex

V700.vlp

Link to comment
Share on other sites

V700v2.vlpIsacovic and Gabriel,

BIG thanks for helping new junior Unitronics programmers.

I corrected showed mistakes, but anyway problem to trart connection. in example I taken for starting is used V700 ETH Card read block. On exit of this block I see value -18157.. So just because of problem connection not established.

Also I read, that for Unitronics Slaves I need to add to Modbus config slaves IP, port and ID. I have no slaves unitronic PLSs, do I need such config for non Unitronic Modbus TCP Slaves?

What you can recommend for me next steps?

With CAS Modbus scanner I can read Holding register form my device.

Error picture and modified program in attachment.

Thank you for helping me.

 

 

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

I stil need your help. Some moments not clear for me:

1. How automatically initialize socket (3 in my case) during start up? (Instead MB11 in my  case) Not always V700 ethernet status = 23, so how restart it in case of unlucky connection at startup or communication lost? Not found in help clear socket usage :(

2. I have MI Modbus IP Holding registers reading status = 7  - from help 

Master-slave data incorrectly synchronized

What does it mean?

3. I need read registers from different Modbus IP devices, not clear how do next steps when first device data received.

Please help me solve these problems

Alex

Unitronics_V700step4c.vlp

Link to comment
Share on other sites

1. You have correctly initialized Socket 3. What is the purpose of MB11? Looks to me like it has to be switched on manually. Also it is better to call "Socket Connect" block over transition contact. Maybe something like this:

snip.PNG.11ce3e491f916372a7bfd5511d7c5d30.PNG

It will reconnect after losing connection. In rung 3 you are closing socket after Modbus command, you don't need to do that.

Maybe socket status changes to other value than 23 while sending Modbus command and may trigger connect block if it stays like that for more than 5 seconds in this example. You may have to investigate this. Also look into "Keep alive" values for sockets if they suit your application.

Generally it is wise to have logic that will recognize connection problems in situations like this and try to automatically clean up what needs cleaning up and connect what needs connecting.

2. 🤷‍♂️

3. Initialize 2 more sockets. You have 8 sockets available in V700. Manage them the same way like the first one. They can work independently. If you ever need to communicate with more devices than you have sockets you need to make logic to connect and disconnect from various slaves, but that's not the case here. Leave one socket for your PC connection.

Link to comment
Share on other sites

Hello,

Could you please check how correctly I created socket initialization?

Some new questions:

1. Problem - sockets not always started (status 19 and stay so), how to restart it in such case correctly?

2. I can read only one register from Danfoss device, if more - I receive error. How correctly create sequence to read registers one by one?

3. How correctly open socket for PC connection? Now I use free comport connection, but which port and protocol should I choose for PC connection?

 

BR,

Alex

 

 

Unitronics_V700step5a.vlp

Link to comment
Share on other sites

  • MVP 2023

- MODBUS Config MUST be activated by a Positive Transition (or SB 2).
- You cannot initialize multiple sockets to the same port number. Remember that the Port number in the Socket Initialization FB is for the PLC. You assign the Port number you are connecting to in the MODBUS Configuration and the Connect functions. The PLC port numbers and the slave device port numbers are unrelated.
- Do NOT place more than one logic thread in a ladder rung (such as you have in rungs 6-8 & 14.
- Your 3 slave devices need to have different IP addresses, which is placed in the 3 MODBUS config blocks and the Connect blocks (each MODBUS Config must match with the corresponding Connect).
- The R.H.R. must be associated with the corresponding Configuration block.

The sequence you want for MODBUS TCP is as follows:
1) Initialize Ethernet card
2) Initialize Socket
3) Configure MODBUS TCP
4) Set a bit to connect the socket to the slave
5) Perform the Socket Connect
(All of these are usually activated by SB 2)
6) Reset the connect bit at the end of the connect rung
7) After connection is established, perform the R.H.R. (or other MODBUS command) communication at the required interval.

You can read from 3 different slave devices simultaneously if they each use a different socket. Each socket is independent.

In order to read multiple registers, they either need to be addressed closely enough to read a vector that includes all the data you want, even if you don't need some of the data in between, or you will need multiple R.H.R. functions that are called separately with a small time interval to allow each read to complete.

There are example projects that came with your VisiLogic installation that show this in detail. They included projects specifically for the V700. Take a look at those for help on this.

Link to comment
Share on other sites

Yea, this last version is a little messy. Status 19 means that the socket is initialized properly, when it connects it changes value to 23.

Change those port numbers and separate rungs as Flx said and tell us how it goes. If you need to connect from a PC over Ethernet just initialize one socket as TCP slave.

Link to comment
Share on other sites

Flex727 and Isacovic,

big thanks you are helping me. Now step by step situation is better and better clear what is going on. Improved communication, divided program part to be clear readable. Added socket for communication with PC. Works now.

Some more new question appears:

  1. Sometimes not all sockets has statuss 23, often statuss 19 or 21. Found out that is also depends other side – device wihch I want communicate other side over selected socket. But how better control such problems with sockets? I just added key to restart whole communication, but also not always helps..

  2. In Modbus communication configuration ( I need work with 3 Modbus IP devices) I put different Modbus ID address of my PLC, when I use the same – also looks some problems with socket initialization. But how do it correctly?

  3. I don't know why, but I can read from Danfoss ECL only one Modbus register at time, vector reading not working… Modbus CAS scanner can read more than one register.. How correctly read registers one by one? Please look on my program's 14, 15 rungs. How do modbus reading in sequence of many registers? (I need aprox 30-40 registers to read from one device, and they not going one by one)… Not found such example unfortunately, need your advice in that case..

BR,

Alexander

P.S. Flex727 thank you for explain very in detail what to do step by step. This is REALLY helpful for novice who begin work with Unitronic devices.

Unitronics_V700step6b.vlp

Link to comment
Share on other sites

Hi, Found some answers and updated mu program:

1.  Will check status of sockets, in 19 or 21 - will try to restart socket (close it) and open again.

2. Found if PLC is Master - all ID should be 255, not needed to be changed.

3. Now can read more than one register. Vector reading  (I can't read 10 registers going one by one) not working for me with Danfos ECL, but I can read them one by one. I added (S) and (R) elements to create sequence to read registers one by one.

Will continue add more registers I need to read.

Thank you for helping.

Unitronics_V700step6c.vlp

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