7/12/2009 12:19 PM | |
Joined: 10/7/2005 Last visit: 3/25/2025 Posts: 3042 Rating:
|
Hello Samkcr please have a look at the threads below which I'm sure you'll find useful (the first one also contains a downloadable S7 example project courtesy of DR75). Multiple Modbus RTU slaves with CP341 Communication between s7-300 and 9 honeywell controllers CP341 Master I hope this helps and good luck with your project |
Cheers |
|
This contribution was helpful to
2 thankful Users |
7/13/2009 5:05 PM | |
Joined: 10/23/2005 Last visit: 3/31/2020 Posts: 81 Rating:
|
Samkcr, Dont think of having 8 different slaves but 8 different calls on the network. If you can setup 8 different calls to read data out of one slave then you can read data out of 8 different slaves. You just have to change where the data's is going to be written and what slave address, Function number, Starting register, and how many registers you want. Then it is all a matter of timing through the calls. I attached SCL program and data block I have setup to do this. Good Luck Attachmentdata block for modbus master.pdf (380 Downloads) |
7/14/2009 4:56 PM | |
Joined: 3/24/2009 Last visit: 8/7/2023 Posts: 406 Rating:
|
Hi.... AttachmentPGM.zip (319 Downloads) |
All is well :-) |
|
7/15/2009 2:33 PM | |
Joined: 10/7/2005 Last visit: 3/25/2025 Posts: 3042 Rating:
|
Hello again samkcr your screendumps do unfortunately not tell the whole"story", most noteably missing is how you trigger a new P_SEND_RK (via DB40.DBX0.0 in your (Siemens) example). Unless this trigger is synchronised with the completion (succesful or otherwise) of the previous request ANDyour timer based supply of newRequest and Receive DB numbers, you will end up in strife. You need to bear in mind that this type of communication (somewhat obviously) requires a fair few OB1 scans between issuing the modbus READ request (via P_SEND_RK) and the receipt of the requesteddata (via P_RCV_RK). More importantly though you also need to bear in mind that P_SEND_RK and P_RCV_RK by themselves may operate asynchronously,which means thateach one of them may extend over more than oneOB1 scan before its finished doing what you asked it to do. As such You must avoid changing their call parameters (includingrequest/receipt DB numbers) until they'll let you know that they've finsihed (via check of DONE, NDR and/or ERROR), as otherwise you can end up with your data not going where you think it should go (which is what you observe). I also really can't see the need for timers to be honest, and belive they just add complexity but offer no value. I'dsuggest you "simply" use theDONE, NDR and ERROR bits to determine whento move to the nextModbus request (see also Dchartiers previous advise and what is contained in the supplied links and examples). I hope this helps and good luck |
Cheers |
|
7/15/2009 5:43 PM | |
Joined: 3/24/2009 Last visit: 8/7/2023 Posts: 406 Rating:
|
Hi.... It is my first experience in dealing with CP341 so it is some what complicated to me....... Attachmenttrigger.zip (323 Downloads) |
All is well :-) |
|
7/17/2009 2:32 PM | |
Joined: 10/7/2005 Last visit: 3/25/2025 Posts: 3042 Rating:
|
and therein lies the problem. Your 10 sec SEND/RECEIVE DB "change" timer runs independent of this and you will have to end up in situations where your logiceither changes the DB's while a P_SND_RK or P_RCV_RK is active AND/OR change only the P_RCV_RK DB after you started with an unreleatedP_SND_RK DB. I'd love to help you samkcr, but don't know what else to advise apart from what has already been said (and is contained in the links). I'll try to surmise anyhow: 1.) Throw away your timers 2.)"Simply" change to a new pair of SEND/RECEIVE DB's when the previous job has finished (P_SND_RK DONE or ERROR). The only thing on top of that is to makesure to "trigger" a new P_SND_RKrequest too afterwards. 3.) Alternatively, use and expand theexample provided by DR75 to make it work with 8 Modbus Slaves instead of 3. I hope this helps and good luck |
Last edited by: fritz at: 7/17/2009 2:36 PMCheers |
|
Follow us on