Jump to content

Recommended Posts

Posted

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.

Thanks!

config_mixed_data.png

  • MVP 2023
Posted

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.

  • MVP 2023
Posted

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.

Posted

Thank you very much for the feedback. I found some examples where they always opened and disconnect the communication, so I thought it has to be.

I will change everything today so that it will work correct. I will also open the connect once as you explained.

Thanks again! 

  • MVP 2023
Posted

I didn't have time to go through your programs in enough detail to know that there aren't other problems. If after fixing the above it still doesn't work properly, re-post your programs and we'll take another look.

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.