naturephoenix
Member
Program structure - s7-1200 MODBUS RTU Master with multiple slaves & multiple registe
I'm having problem to make a appropriate structure of my program. Trying to make MODBUS RTU communication between my master s7-1200 and 4 slaves.
From each slave I'm reading same registers.
I have divide registers into 2 groups, for an example. (There are more groups but for this example two are enough)
Group 1-> 4001, 4003, 4005
Group 2-> 4221,4223,4225
Let's look for slave No. 1
Data from all groups I have placed/stored into same DB, just with different adress.
Into first network I called "MB_COMM_LOAD_DB",
1. NW1 -> FB "MB_COMM_LOAD_DB"
Into second network I called ""MB_MASTER_DB"" & I'm reading Group 1
2. NW2 -> FB MB_MASTER_DB
Into third network I called ""MB_MASTER_DB"" & I'm reading Group 2
3. NW2 -> FB MB_MASTER_DB
Difference between NW2 and NW3 is "DATA_ADDR" and "DATA_PTR"
In both cases FB "MB_MASTER_DB" is using same instance data block.
Question 1: Is this right way to do?
---
Now lets expand this on second slave(slave number 2), which has same groups as slave number 1
Question 2: Should I use new instance data block for FB_MASTER_DB for needs of slave 2, if I do then I should change input parameter "MB_DB" of FB "MB_COMM_LOAD_DB". or I just need to use new FB "MB_MASTER_DB" just like it was case of new group of registers into same slave.
Ok I know I need to change MB_ADDR, but is that just all?
Question 3: Should I make sure to not call FB "MB_MASTER_DB" for group 2 of slave No.1 until previous FB "MB_MASTER_DB" for group 1 of slave No.1 return done and no error.
Was planning to store data from second slave into different DB than slave 1. DBs of slave 1 and slave 2 have same structure. Group 1 and Group 2 are same into both slaves.
I'm having problem to make a appropriate structure of my program. Trying to make MODBUS RTU communication between my master s7-1200 and 4 slaves.
From each slave I'm reading same registers.
I have divide registers into 2 groups, for an example. (There are more groups but for this example two are enough)
Group 1-> 4001, 4003, 4005
Group 2-> 4221,4223,4225
Let's look for slave No. 1
Data from all groups I have placed/stored into same DB, just with different adress.
Into first network I called "MB_COMM_LOAD_DB",
1. NW1 -> FB "MB_COMM_LOAD_DB"
Into second network I called ""MB_MASTER_DB"" & I'm reading Group 1
2. NW2 -> FB MB_MASTER_DB
Into third network I called ""MB_MASTER_DB"" & I'm reading Group 2
3. NW2 -> FB MB_MASTER_DB
Difference between NW2 and NW3 is "DATA_ADDR" and "DATA_PTR"
In both cases FB "MB_MASTER_DB" is using same instance data block.
Question 1: Is this right way to do?
---
Now lets expand this on second slave(slave number 2), which has same groups as slave number 1
Question 2: Should I use new instance data block for FB_MASTER_DB for needs of slave 2, if I do then I should change input parameter "MB_DB" of FB "MB_COMM_LOAD_DB". or I just need to use new FB "MB_MASTER_DB" just like it was case of new group of registers into same slave.
Ok I know I need to change MB_ADDR, but is that just all?
Question 3: Should I make sure to not call FB "MB_MASTER_DB" for group 2 of slave No.1 until previous FB "MB_MASTER_DB" for group 1 of slave No.1 return done and no error.
Was planning to store data from second slave into different DB than slave 1. DBs of slave 1 and slave 2 have same structure. Group 1 and Group 2 are same into both slaves.
Last edited: