a99900s Posted March 4, 2020 Report Share Posted March 4, 2020 Hello, I have a school project where i was tasked to read an MI from a Slave PLC as a Master PLC. I've tried using the help fuction, but i havent seemed to make it work. Thanks in advance Quote Link to comment Share on other sites More sharing options...
a99900s Posted March 4, 2020 Author Report Share Posted March 4, 2020 I am using the V570 PLC and using a modbus rs232 Quote Link to comment Share on other sites More sharing options...
MVP 2022 kratmel Posted March 4, 2020 MVP 2022 Report Share Posted March 4, 2020 Is it RX-TX cable connected properly? In Example you can see 570 modbus loopback test project with modbus setup for one V570 with two rs232 port connected TX-RX, RX-TX. Use this example for test connection with two device. Both of them can be master or slave on different com port. Quote Link to comment Share on other sites More sharing options...
Cam Posted March 4, 2020 Report Share Posted March 4, 2020 Can you post your code? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted March 4, 2020 MVP 2022 Report Share Posted March 4, 2020 Take a look at the example projects that came with your VisiLogic installation. Quote Link to comment Share on other sites More sharing options...
a99900s Posted March 4, 2020 Author Report Share Posted March 4, 2020 4 hours ago, kratmel said: Is it RX-TX cable connected properly? In Example you can see 570 modbus loopback test project with modbus setup for one V570 with two rs232 port connected TX-RX, RX-TX. Use this example for test connection with two device. Both of them can be master or slave on different com port. Hi, I have a connection to the slave PLC as the other parts of my program do work. My main problem is that i cant find a way to read the Save's MI. Ive tried using the FB's but i cant seem to make it work. Thanks for the respnse! Quote Link to comment Share on other sites More sharing options...
a99900s Posted March 4, 2020 Author Report Share Posted March 4, 2020 4 hours ago, Cam said: Can you post your code? modbus.vlpHere is my program modbus.vlp Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted March 4, 2020 MVP 2022 Report Share Posted March 4, 2020 To read an MI, which is a 16-bit integer, you need to use the R.H.R. #3 function (Read Holding Registers). You are trying to use R.C. #1 (Read Coils). Coils are single bits (MBs). Quote Link to comment Share on other sites More sharing options...
a99900s Posted March 4, 2020 Author Report Share Posted March 4, 2020 1 minute ago, Flex727 said: To read an MI, which is a 16-bit integer, you need to use the R.H.R. #3 function (Read Holding Registers). You are trying to use R.C. #1 (Read Coils). Coils are single bits (MBs). Hi, thanks for the answer. The Read coil function block is just another part of my assignment. I will try the Read holding registers FB. 😃 Quote Link to comment Share on other sites More sharing options...
a99900s Posted March 4, 2020 Author Report Share Posted March 4, 2020 10 minutes ago, Flex727 said: To read an MI, which is a 16-bit integer, you need to use the R.H.R. #3 function (Read Holding Registers). You are trying to use R.C. #1 (Read Coils). Coils are single bits (MBs). I tried using the FB you told me about and i was wondering if i want to read the Slave MI10, would this be the way of doing it? Thanks for the answers! Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted March 4, 2020 MVP 2022 Report Share Posted March 4, 2020 Yes, but two things: 1) Don't use SB 7, use SB 15. SB 7 is a square wave - you want a positive transition. 2) Place an inverted contact of MB 0 (Function in Progress) between SB 15 and the MODBUS read FB. 1 Quote Link to comment Share on other sites More sharing options...
a99900s Posted March 4, 2020 Author Report Share Posted March 4, 2020 3 minutes ago, Flex727 said: Yes, but two things: 1) Don't use SB 7, use SB 15. SB 7 is a square wave - you want a positive transition. 2) Place an inverted contact of MB 0 (Function in Progress) between SB 15 and the MODBUS read FB. Will do! Thanks for the answers Quote Link to comment Share on other sites More sharing options...
a99900s Posted March 9, 2020 Author Report Share Posted March 9, 2020 On 3/4/2020 at 7:35 PM, Flex727 said: Yes, but two things: 1) Don't use SB 7, use SB 15. SB 7 is a square wave - you want a positive transition. 2) Place an inverted contact of MB 0 (Function in Progress) between SB 15 and the MODBUS read FB. I tried, and it worked! But now my force coils are not working anymore, ive tried rearranging them in my program. But either the RHR FB works or the Force coil FB works. They dont seem to work together. Ive also tried adding subroutines but it still doesnt work. Hopefully you can help me. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted March 9, 2020 MVP 2022 Report Share Posted March 9, 2020 Did you try placing a positive transition contact of SB 7 in front of one and a negative transition contact of SB 7 in front of the other? That should work in your case, but the proper way to do this type of communication is to set a bit periodically and place the following in series: Direct contact of the set bit, inverted contact of the function in progress bit, the comm FB, then a reset of the first bit. That allows the function to "wait" while any other communication is in progress. Quote Link to comment Share on other sites More sharing options...
a99900s Posted March 10, 2020 Author Report Share Posted March 10, 2020 (edited) 17 hours ago, Flex727 said: Did you try placing a positive transition contact of SB 7 in front of one and a negative transition contact of SB 7 in front of the other? That should work in your case, but the proper way to do this type of communication is to set a bit periodically and place the following in series: Direct contact of the set bit, inverted contact of the function in progress bit, the comm FB, then a reset of the first bit. That allows the function to "wait" while any other communication is in progress. I will try that, but now i have another problem. My slave PLC has status 2(Reply error) and i havent found out a way to fix it yet. Thanks! Aditionally it keeps connecting and reconnecting. And sometimes it displays status 7 wich i found out to be a data sync error. Edited March 10, 2020 by a99900s adding more text Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.