![]() |
Modbus tcp-ip problem - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Modbus tcp-ip problem (/showthread.php?tid=619) |
Modbus tcp-ip problem - Domoticatorino - 15.02.2017 Hi there, I am trying to integrate a PLC modbus with homelynk. I have imported the profile file as follow: { "manufacturer":"VRA", "description":"Demo", "mapping":[ {"name":"Valvola","bus_datatype":"1","datatype":"bool","type":"coil","address":8970,"writable":false}, {"name":"Valvola","bus_datatype":"1","datatype":"bool","type":"coil","address":8969,"writable":false}, {"name":"Valvola","bus_datatype":"1","datatype":"bool","type":"coil","address":8971,"writable":false}, {"name":"Boost","bus_datatype":"1","datatype":"bool","type":"coil","address":9,"writable":true}, {"name":"Temp ambiente modbus","bus_datatype":"9","datatype":"int16","type":"register","address":8961,"value_multiplier":0.1,"writable":"false"}, {"name":"Temperatura Air Fresh","bus_datatype":"9","datatype":"int16","type":"register","address":8988,"value_multiplier":0.1,"writable":"true"}, {"name":"Temperatura Air Return","bus_datatype":"9","datatype":"int16","type":"register","address":16391,"value_multiplier":10,"writable":"true"}, {"name":"Temperatura Air Return","bus_datatype":"9","datatype":"int16","type":"register","address":16391,"value_multiplier":0.1,"writable":"false"}, {"name":"Temperatura Air Supply","bus_datatype":"9","datatype":"int16","type":"register","address":531,"writable":"false"}, {"name":"Velocità","bus_datatype":"8","datatype":"uint16","type":"register","address":779,"writable":"true"}, {"name":"Temperatura Air Exhaust","bus_datatype":"9","datatype":"int16","type":"register","address":532,"writable":"false"} ] } Communication is ok, temperature information is ok but I do not the reason why I cannot communicate with address 8970, 8969 and 8971. What do you think? Thanks. RE: Modbus tcp-ip problem - admin - 15.02.2017 Try removing datatype field for coils, also keep in mind that your coils are read-only because of writable setting RE: Modbus tcp-ip problem - Mirco - 16.02.2017 Hi, I think the problem is that those addresses are simple registers and not coil, try it! Remember that the value of the field "writable" is used without simbols "", like this: "writable": true Are you programming the PLC? If so can I know the model? So we can help you more ![]() RE: Modbus tcp-ip problem - Domoticatorino - 16.02.2017 I am using a Eliwell. Do you know it? There is another strange think. As you can see I use 2 variable of the same register (16391). One only readable and the others writeable. For one I used value multiplier 0.1 and the other multiplier is 10. Because PLC use 200 for 20 degress. Hence when I sent by HL the value is multiplied of 10 but when plc send its data (in this case is a temperature setpoint) . Everything works fine but sometimes it seems that values is multiplied by 0.1 instead 10 and viceversa the others. What do.you thibk about that? Thanks. RE: Modbus tcp-ip problem - admin - 17.02.2017 Multiplier is applied in reverse during write. Read value conversion: Code: value = value_base + value * value_multiplier Write value conversion: Code: value = (value - value_base) / value_multiplier RE: Modbus tcp-ip problem - Domoticatorino - 17.02.2017 So do you suggest to make a script instead use only modbus profile? Thanks. RE: Modbus tcp-ip problem - admin - 17.02.2017 What I'm saying is that value_multiplier will produce correct values for both read and write, because value conversion is applied in reverse for writing. Also, like Mirco said, writable field must be a boolean, if you set it to "false" it will actually become true because it is a string. RE: Modbus tcp-ip problem - Mirco - 17.02.2017 Last month I have used an Eliwell too, so I am almost sure that registers from 8000 are registers and not coil. As admin say, you don't have to use 2 variables to read and write a register. I'll try to explain with an example: {"name": "Temperatura Air Return", "bus_datatype": "9", "datatype": "int16", "type": "register", "address": 16391, "value_multiplier": 0.1, "writable": true}, if in your register 16391 there's the value 200°C, with the thet code you read 20,0°C and when you try to write, for example 30,5°C, in your PLC the homelynk will write 305°C. Hope I was helpful ![]() RE: Modbus tcp-ip problem - Domoticatorino - 17.02.2017 Thank you mate. I am agreed with you but it seems that when I wrote to PLC 30,5 °C PLC received 30,5 and not 305. This is the reason why I add the same variable with 2 different writable. Unfortunately now I cannot test it and I will be back the next week on the plant. Thanks. |