Jump to content

Modbus IP - Read/Write Mixed Data - Can't read from Slave

Recommended Posts

Hi erveryone,


i'm new here. So i hope I have set my question correct in this forum.

I'm trying a communication between two V1210 with Modbus IP.

What is working:

The connection between the plc's is working and I can write the MB's from master to slave with the MixedData function.

The problem is, that I can't read the MB's from the slave to the master. 

But I can't find my fault config for reading. For me it makes no sense why writing is working but reading isn't.

I only have one MixedData function with read and write.


Maybe someone can help me.



Link to comment
Share on other sites

  • MVP 2023

I use this function all the time between two Unitronics PLCs and have never had any trouble. I don't think it's possible to troubleshoot based on the information you've provided. Can you post your program? If not, I recommend that you review all the Ethernet and MODBUS configurations in both PLCs with a careful eye. All it takes is one little mistake to keep it from working properly.

Link to comment
Share on other sites

  • MVP 2023

Just looking at your Haustechnik.vlp file, you need SB 2 in front of your MODBUS Configuration block in ladder rung 12 of the Main Routine. You are currently initializing your MODBUS Configuration on every scan which can interfere with communication. Your TCP/IP Connect and MODBUS R/W functions appear to be trying to work on a single scan. You can't do that. You do not need to disconnect after every R/W. Just connect then leave it connected, then perform your R/W function whenever you want, but no more often than about every 50-100ms. If you insist on connecting and disconnecting for every R/W (very much NOT advised), then make sure you allow TIME for all that to occur - Ethernet connect and disconnect can be SLOW.

For your Connect function, Set a bit at the end of your MODBUS Config, then use that bit (direct contact, not a transition) to Connect. At the end of the Connect thread, Reset the bit. Once the Socket is connected, you can communicate at will.

There is no reason to scatter your communication functions all over your program. Place your Configs and Connects in the Main Routine near the top with the SB 2 stuff. Your R/W function can be elsewhere as needed. This helps with troubleshooting. In the slave program I would also place the SCAN_EX in the Main Routine near the top. None of this prevents the program from working, but it is best practice.

Also PLEASE stop putting multiple logic threads in a single ladder rung. For example, in rung 10 you have 4 separate subroutine calls in the ladder rung. That should be 4 separate rungs. Same thing in rung 12. That subroutine call should be in a separate rung. Another example, BMA Routine rung 1 you have 3 logic threads in a single rung. Yes, this often works, and no you don't get a compile error, but it is extremely poor programming practice and can cause unfortunate logic bugs due to the compile being different than what you expect.

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.

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