Iris _

Pixsys Forum

everybody's effort for the same goal

Modbus RTU communication with two or more pixsys TD410 PLCs

JeffSayto123
Posts: 4
Joined: 04/03/2021, 8:56

Modbus RTU communication with two or more pixsys TD410 PLCs

Post by JeffSayto123 »

Hello with everyone I am doing a modbus RTU communication project which I want to read a variable from the slave to the master. :shock:
If anyone can help me, I would be very grateful. 8-)
Att Jeff
Pixsys tecnico 1
Moderatore
Posts: 1649
Joined: 29/10/2010, 10:09
Contact:

Re: Modbus RTU communication with two or more pixsys TD410 P

Post by Pixsys tecnico 1 »

Hi,
the TD410 will be master o slave?
JeffSayto123
Posts: 4
Joined: 04/03/2021, 8:56

Re: Modbus RTU communication with two or more pixsys TD410 P

Post by JeffSayto123 »

Pixsys tecnico 1 wrote:Hi,
the TD410 will be master o slave?
Hi
I have 2 TD410 one I want to make a master and the other a slave.
Please can you help me with the type of configuration that I have that does in the software
Pixsys tecnico 1
Moderatore
Posts: 1649
Joined: 29/10/2010, 10:09
Contact:

Re: Modbus RTU communication with two or more pixsys TD410 P

Post by Pixsys tecnico 1 »

So one TD410 will be master and the other will be slave.

TD410 as Slave Modbus TCP-IP:
Refer to example 6 here: https://forum.pixsys.net/viewtopic.php? ... 6603#p6603

TD410 as Master Modbus TCP-IP:
- On the resources/Ethernet section enable flag on "Modbus TCP master"
- Right mouse click on "ethernet", "Add"
- Select "Generic Modbus", a device called "Generic_Modbus_1" will appear under Ethernet
- Select "Generic_Modbus_1" and fill in the "IP address" leaving the rest as default
- Right mouse click on "Generic_Modbus_1, "Add"
- Select the Modbus function you need. Please use "FC-03" to read registers, "FC-06" to write a single register, "FC-16" to write a series of consecutive registers (optimized communication).

Example for reading registers:
- "General" tab: fill in the register address you want to read at "Start address"
FC03_Master_TCP_1.JPG
- "Holding Reg" tab: in the "Label" field", Assign the PLC variable where the value will be store (internal master PLC variable)
FC03_Master_TCP_2.JPG
So the value will be read in the "start address" from the slave and stored in the "label" variable of the master.
If you need to read more than one variables, in the "Holding Reg" tab you can press "ADD" button and insert the new destination variable. Keep in mind that in this case the variables must be consecutive of the "Start address" declared. If you need to read a non consecutive register, you need to make a right mouse click on "Generic_Modbus_1, "Add", "FC-03" etc like described above.

The writing way is similar, you just need to know if you need to write a single register (so use "FC-06" Modbus function) or some consecutive registers (so use "FC-16" Modbus function).
You do not have the required permissions to view the files attached to this post.
JeffSayto1234
Posts: 9
Joined: 21/06/2021, 13:35

Re: Modbus RTU communication with two or more pixsys TD410 P

Post by JeffSayto1234 »

Pixsys tecnico 1 wrote:So one TD410 will be master and the other will be slave.

TD410 as Slave Modbus TCP-IP:
Refer to example 6 here: https://forum.pixsys.net/viewtopic.php? ... 6603#p6603

TD410 as Master Modbus TCP-IP:
- On the resources/Ethernet section enable flag on "Modbus TCP master"
- Right mouse click on "ethernet", "Add"
- Select "Generic Modbus", a device called "Generic_Modbus_1" will appear under Ethernet
- Select "Generic_Modbus_1" and fill in the "IP address" leaving the rest as default
- Right mouse click on "Generic_Modbus_1, "Add"
- Select the Modbus function you need. Please use "FC-03" to read registers, "FC-06" to write a single register, "FC-16" to write a series of consecutive registers (optimized communication).

Example for reading registers:
- "General" tab: fill in the register address you want to read at "Start address"
FC03_Master_TCP_1.JPG
- "Holding Reg" tab: in the "Label" field", Assign the PLC variable where the value will be store (internal master PLC variable)
FC03_Master_TCP_2.JPG
So the value will be read in the "start address" from the slave and stored in the "label" variable of the master.
If you need to read more than one variables, in the "Holding Reg" tab you can press "ADD" button and insert the new destination variable. Keep in mind that in this case the variables must be consecutive of the "Start address" declared. If you need to read a non consecutive register, you need to make a right mouse click on "Generic_Modbus_1, "Add", "FC-03" etc like described above.

The writing way is similar, you just need to know if you need to write a single register (so use "FC-06" Modbus function) or some consecutive registers (so use "FC-16" Modbus function).
Mr. Pixsys tecnico 1, what address do you enter in the general Modbus FC-03 block?
Pixsys tecnico 1
Moderatore
Posts: 1649
Joined: 29/10/2010, 10:09
Contact:

Re: Modbus RTU communication with two or more pixsys TD410 P

Post by Pixsys tecnico 1 »

as master, in "general" tab you have to enter the "start address", so the register of the first address you want to read from the slave with this FC-03 function.
In my example, in the slave I "publish" the register 10000 so in the master, the start address is set as 10000.

So in the "start address" you must insert the register of the slave you want to read/write.
JeffSayto1234
Posts: 9
Joined: 21/06/2021, 13:35

Re: Modbus RTU communication with two or more pixsys TD410 P

Post by JeffSayto1234 »

Pixsys tecnico 1 wrote:as master, in "general" tab you have to enter the "start address", so the register of the first address you want to read from the slave with this FC-03 function.
In my example, in the slave I "publish" the register 10000 so in the master, the start address is set as 10000.

So in the "start address" you must insert the register of the slave you want to read/write.
Mr. Tecnico 1 I did all the steps that you suggested but I added a variable in the master to see if the holding register works and I get this error:
You do not have the required permissions to view the files attached to this post.
JeffSayto1234
Posts: 9
Joined: 21/06/2021, 13:35

Re: Modbus RTU communication with two or more pixsys TD410 P

Post by JeffSayto1234 »

This error tells me that the address of the holding register is illegal, I have seen the tutorials that you sent me about the slave but I think that in previous versions of Logic Lab you could add the address of the slave variable.
How can I set the modbus address to the slave variables, for example the address 1000?
Pixsys tecnico 1
Moderatore
Posts: 1649
Joined: 29/10/2010, 10:09
Contact:

Re: Modbus RTU communication with two or more pixsys TD410 P

Post by Pixsys tecnico 1 »

The modbus address of the slave's variables are automatically assigned where you add a variable in the "Status variables" table.
Mind that the start address is 10000 not 1000.
Mind also that for each variable you must decide if it can be written by the master (read only = false) or only read (read only = true)
status_variables.JPG
You do not have the required permissions to view the files attached to this post.
JeffSayto1234
Posts: 9
Joined: 21/06/2021, 13:35

Re: Modbus RTU communication with two or more pixsys TD410 P

Post by JeffSayto1234 »

Pixsys tecnico 1 wrote:The modbus address of the slave's variables are automatically assigned where you add a variable in the "Status variables" table.
Mind that the start address is 10000 not 1000.
Mind also that for each variable you must decide if it can be written by the master (read only = false) or only read (read only = true)
status_variables.JPG
Thank you very much Mr. Pixsys Tecnico 1 I was able to read variables from the slave with Modbus FC 04 Read Input Register.
Post Reply