Hovewer, PLC have limit how many sockets can be open simultaneously at same time to/from PLC. Different IDs open different TCP socket I think. If you use different IDs for blocks, you can call several blocks same time for different IP-numbers or for same IP-address. If you use same ID-parameter for blocks you need to make sequence to blocks. You need to give connection ID parameter to MB_client block. However, haven't tested this with Siemens Modbus TCP, on TCP-side it should be possible to use several querys same time. (You change paramters between MB_master sending and before slave answers back) Otherwise if you change input parameters of MB_master blocks, it is possibly that you get slaves answer to wrong slave.
Yes, don't call another MB_master_DB before busy signal is "0", (at least on serial data only one modbus query can be on at one time on same port). It is easier to look after several years than indirectly maded program. Tryed to make that work before, but eventually coded with long way and using several FB_master-blocks. It should also be possible that you indirectly pass different parameters on one MB_master_Comm and call only it after new parameters are transferred to block. If you want make com ok/error counters, then inc counters, if MB_comm is called to slave (look sequence number) and Done or error signal is "1" same time. Because you use 1200CPU, you don't probably take care of this. MB_comm_load needs to call also, if you remove card and reinsert, if PLC is powered. On PLC restart is good practise also to reset MB_MASTER_BLOCK (put FB_MASTER block to OB100 and give reset signal to block) Program is little bit less messy, if you only look busy signal directly of DB641.DBX12.1 (FBs own DB-block). > If PLC restart, clear all busy variables on OB100 block, otherwise you can have some "busy" variables stucked to "1" state and comms are stucked if your sequencer looks them.ĭone and error are only at "1" one PLC scan, so resereting of them is no needed necessarily.
INC sequencer number only after little time (100ms-1s) if MB_MASTER_BLOCKs "busy" signal is "0"īecause FB_block is update by sequencer, be careful if you copy MB_master_blocks output signal to several different variables on program side. If you use same DB641 for all comms, there is only need to call MB_COMM load one time) (MB_master (FB) and (DB) are linked to MB_COMM_load block. That way you need only do port initialization only one time when PLC starts.
Outputs pins you can let unconnected and look output data from instance data block instead (DB641))įor all MB master blocks use only one Instance data block (DB641? on 1200CPU) Only mode, data_addr, data_len and data_point pins have different values depending of network. (Rise correct MB_master block EN-pin high depending of sequence.
Use several MB master blocks (FB), but enable only one by time depending of sequencer Group 1 and Group 2 are same into both slaves. DBs of slave 1 and slave 2 have same structure. Was planning to store data from second slave into different DB than slave 1. 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. Ok I know I need to change MB_ADDR, but is that just all? or I just need to use new FB "MB_MASTER_DB" just like it was case of new group of registers into same slave.
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". Now lets expand this on second slave(slave number 2), which has same groups as slave number 1 In both cases FB "MB_MASTER_DB" is using same instance data block. Into third network I called ""MB_MASTER_DB"" & I'm reading Group 2ĭifference between NW2 and NW3 is "DATA_ADDR" and "DATA_PTR" Into second network I called ""MB_MASTER_DB"" & I'm reading Group 1 Into first network I called "MB_COMM_LOAD_DB", (There are more groups but for this example two are enough)ĭata from all groups I have placed/stored into same DB, just with different adress. I have divide registers into 2 groups, for an example. Trying to make MODBUS RTU communication between my master s7-1200 and 4 slaves.įrom each slave I'm reading same registers. I'm having problem to make a appropriate structure of my program.