Jasper123
I want to know how OpenPLC converts this or atleast what modbuss address is connected to what variable
Reply 0 0
fg71
When you make plc program in OpenPLC Editor the start address is 100. When you configure OpenPLC runtime the start address depend
what hardware you are connected to.
 
Here is example of Modbus address space for Siemens LOGO, you could see it use range 8193 - 8212 (with offset of 1) for coil.
Siemens do not use offset of 1 (when modbus was invented it use offset of 1) it use offset 0 and maybe are more common.
It means the start address is not 8193 it instead is 8192 - 8211.
 
So when you configure a modbus communication you configure the start address for the hardware you like to do communication with.
 
OpenPLC Editor the start address is 100, in OpenPLC runtime it depends what hardware or device that is modbus server/slave.
 
[203128%2F9090360%2Fmceclip0]
Reply 1 0
Jasper123
is there no standaard link between the QX and a modbus address?

I mean like how do i know when i put in my variables QX0.1 what modbus register its talking to and is that a standaard thing or is it per device different?


Reply 0 0
fg71
You could read more about modbus server/slaves for OpenPLC Runtime
Reply 1 0
fg71
variables QX0.1
This would be %QX100.1
 
In other words second bit (8 bits) of the first address 100, Thiago have decided to use address 100 for Modbus.
And if you like to use ninth bit you use %QX101.0
Reply 2 0
Jasper123
i found what i need on 2.5 Modbus Addressing – Autonomy
but i still have a question if u have the time

If i add multiple Modbus/tcp devices with the same register numbers do i need to make it so the starting address is different or how do i configure that in my runtime device tab?
Reply 0 0
Jasper123
This would be %QX100.1
yeah i get that part but what modbus address (register) is connected to that %QX100.1 is that 00001 or is that different on what starting address i use or how does this work?
 
so this means %QX101.0 = 00009 in modbus address
Reply 0 0
fg71
Modbus RTU use slave id you could have up to 255
Modbus Tcp use port number default 502, to connect to other device on same domain you use other port number.
That is not different from a Web server that use 8080 or 9000 if that port is already busy.
Reply 1 0
fg71
I'm only guessing now because I have never connected 2 Arduino compatible board to each other. When I test Modbus I use a real PLC.
The start address in OpenPLC runtime I guess could be 0 for coil but if you use descret input or holding registers you need to have a different start address.
Reply 1 0
Jasper123
ill test that next week because i have a RPI with runtime and a MoxaIOLogik E1242 and a redlion to test and i have a little switch to have multiple modbus devices connected to my RPI
 
if u want to know the results ill post them here (Thumbs up if someone wants to know the results)
Reply 0 0
fg71
I find this for your PLC, it looks from UI that you could map the register to your configuration.
 
[203128%2F9090416%2Fmceclip0]
Reply 1 0
thiagoralves
When you add multiple devices, the addresses add up. For example, if you add one slave device with just one coil, its coil will be mapped to %QX100.0 on the OpenPLC master. If you add another device with one coil, its coil will be mapped to %QX100.1. The address space is linear, and slave devices are mapped linearly. When one ends, the other starts.
Reply 1 0
fg71
The Client/Master have a reference point to server/slave. The client/Master read the value from server/slave and update memory register.
Other device HMI is connected to Client/Master and listen to tag. The tag get updated with a new value it get from memory register.
The Client/Master the controller perform a action to update the HMI view.
 
There is design pattern that call MVC (Model-View-Controller). That said not all devices use this but it describe very well how things are connected to
each other. If you have ever use Objective-C on macOS platform you will understand how MVC works.
 
You could say a server/slave = model, client/master = controller and HMI is the view.
Reply 1 0
thiagoralves
yeah i get that part but what modbus address (register) is connected to that %QX100.1 is that 00001 or is that different on what starting address i use or how does this work?
 
so this means %QX101.0 = 00009 in modbus address
To be clear on that, %QX100.1 is going to be your second coil on your first slave device, however you’ve mapped it in the slave settings. If you mapped it to start on slave address 0, then %QX100.1 is going to be your slave coil address 1 (the first coil is address 0). If you mapped it to start on slave address 5, then %QX100.1 is going to be your slave coil address 6. So it all depends on how you configured the start addresses for your slave devices.
Reply 1 0
fg71
Its also important to know if the device use offset 0 or 1 for Modbus address register because that could be different and maybe not documented.
Reply 1 0
Reply