Logic Machine Forum
Modbus Schneider PLCs - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Modbus Schneider PLCs (/showthread.php?tid=1274)



Modbus Schneider PLCs - iJAF - 05.03.2018

Hello Im trying to optimize a modbus communication on order to read from a tcp slave (it will be a schneider PLC) with a single request.

First I'm triyng with floats, this is my test which is sending 3 separated requests:

{"name":"Teste1","bus_datatype":"float32","type":"register","address":0,"writable":"true" },
{"name":"Teste2","bus_datatype":"float32","type":"register","address":2,"writable":"true" },
{"name":"Teste3","bus_datatype":"float32","type":"register","address":4,"writable":"true" }

I have tryed to implement the following json, but without success :

{"name":"Teste1","bus_datatype":"float32","type":"register","address":0,"writable":"true","Read_count":3,"Read_offset":0 },
{"name":"Teste2","bus_datatype":"float32","type":"register","address":0,"writable":"true","Read_count":3,"Read_offset":2 },
{"name":"Teste3","bus_datatype":"float32","type":"register","address":0,"writable":"true","Read_count":3,"Read_offset":4 }

Any sugestions ?

Thank you Big Grin


RE: Modbus Schneider PLCs - admin - 05.03.2018

All JSON keys must be lowercase, but you have Read_count and Read_offset. read_count must be 6, it is counted in 16-bit registers so 2 x 3 in your case. Also, you are probably missing "datatype": "float32" for each profile entry.


RE: Modbus Schneider PLCs - iJAF - 05.03.2018

Thank you ! I will try it

But i have found another issue with float32.

I have to swap the 2x16bit registers themselves that create the correct float.

Reg0 = 3F80
Reg1 = 0000

to

Reg0 = 0000
Reg1 = 3F80

I have tried the read_swap="w" but I see no difference

Note: I'm using the json profiles

Any easy way to do this ?

Thank you


RE: Modbus Schneider PLCs - admin - 05.03.2018

Set swap to n, word swap (w) is set by default


RE: Modbus Schneider PLCs - iJAF - 06.03.2018

Hello,

The reading is working perfect now, but unfortunately when I try to write to one of the variables I'm only writing to the first one.
For example if I write for the third variable the value 22.0, this value will be written to the first one, in the slave !

I am using this simple profile:

{"name":"Teste1","bus_datatype":"14","datatype":"float32","type":"register","address":0,"writable":"true","read_count":6,"read_offset":0,"read_swap":"n" },
{"name":"Teste2","bus_datatype":"14","datatype":"float32","type":"register","address":0,"writable":"true","read_count":6,"read_offset":2,"read_swap":"n" },
{"name":"Teste3","bus_datatype":"14","datatype":"float32","type":"register","address":0,"writable":"true","read_count":6,"read_offset":4,"read_swap":"n" }

Am I doing anything wrong ?

Thank you


RE: Modbus Schneider PLCs - admin - 06.03.2018

For write to work you need to set address field correctly, but this will break single block read. We might add another field (write_address) for cases like you have in future releases.

For now you have two options:
1. Do not use block read at all
2. Create another set of registers with "write_only": true, disable writable for original registers and use their values as status objects in visualization. This will introduce a delay between status object update due to polling interval.