How to handle MB connect and multiple modbus RTU slaves commected to COM3?
I will use PM856 as modbus master to communicate with multiple modbus slaves.
Slaves will be connected via RS232/485 converter on COM 3.
Due to MB master can only communicate with one MB slave at the time, is it necessary to disconnect "MBConnect" function block and connect it again each time I want to switch communication to another MB slave?
Or is it possible to have multiple "MBConnect" function blocks connected to COM3 and only read and write to one slave at the time?
Someone who have code sample for this?
You will need MBConnect blocks, as much as number of slaves - each slave needs own MBConnect block.
For each MBConnect you have to specify the unique slave address (Partner) and ID, but all of them could be connected to the same COM3 (Channel)
Then you have to connect different number of MBRead and MBWrite blocks to each MBConnect, according to what you need to read/write.
In AKS applications part there is a document Modbus for beginners: