10/2/2014 7:57 AM | |
Posts: 7 Rating: (0) |
I'd like to have a modbus device read. It works fine by modbus master block. But I want to write a block to specific device, then use as many blocks with as many instance db's, as many device I have. I dont know how to reference an FB's static memory space (pointer) to Modbus Master DATA_PTR pin. Since that DB not exists, when I complie the block, and I dont know how many will be, what its number will be. Waht is the correct solution? And the second: Is it possible to have an array of struct to store all the required Modbus communication data, and call mb master block with the paramerters from array? The main question still the data_ptr, what kind of variable should be used inside of the struct? Variant cannot be used, TIA says. Thanks |
10/8/2014 9:11 AM | |
Joined: 10/10/2005 Last visit: 1/17/2025 Posts: 1925 Rating: (136) |
Hello, please find the FAQs in the internet and I hope these could be mainful for you: http://support.automation.siemens.com/WW/view/en/59623719 http://support.automation.siemens.com/WW/view/en/57132240 http://support.automation.siemens.com/WW/view/en/57374718 http://support.automation.siemens.com/WW/view/en/42603881 With best regards |
10/8/2014 3:17 PM | |
Joined: 7/7/2010 Last visit: 1/17/2025 Posts: 15541 Rating: (2465)
|
Are you asking whether the s7-1200 program can create a new DB on demand and use that new DB for another Modbus device? I think that is not currently available unless you use s7-1500 which can create a DB under program control, but even then I am not sure about this solving your problem. If you are asking how to use multi-instance FBs so each instance DB relates to a single drive, well, that is not so difficult. Just make sure everything inside the FB is referencing no global tags or DBs and only uses instance DB tags. You may want to think about a UDT to make it easier to pass in data to the instance FBs. Now I think we need feedback from you. |
science guy |
|
10/9/2014 8:03 AM | |
Posts: 7 Rating: (0) |
No, I think I wasnt clear enough. I dont wanna create db during runtime. I wanna create an fb which has only an input for modbus address of the desired device. Afterwards I put this fb to (lets say) to main ob several times with different instance dbs. The fb would include the MB_MASTER instruction. But in the FB on the DATA_PTR input of the MB_MASTER, how to refer to a local static tag (it requires a pointer!), not a static address of a given db or m area. If I declare: Local Static mb_dev_data array [1..100] of word on the MB_MASTER DATA_PTR input should be something like that: P# #mb_dev_data, but its not working.
|
10/9/2014 11:15 AM | |
Posts: 7 Rating: (0) |
Cicero, Construction of a pointer is clear. But see those examples! All of them are using a specified db for pointer. I want to have a pointer for the fb's own instance db, which is different with every call. |
10/10/2014 12:09 AM | |
Joined: 9/15/2010 Last visit: 12/10/2024 Posts: 80 Rating: (13) |
not possible in s7-1200, maybe just use an fb with an input (modbus address) and inside the fb, you can read/write to the desired slave with the desired data, one device after the other one. I've made it once with sinamics over modbus rtu. |
---------------------------- |
|
Follow us on