Modbus script - 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 script (/showthread.php?tid=305) |
Modbus script - oyvindnordbo - 19.05.2016 I have make a script to av ventilation system, but I cant get register 12, 13, 109, 115, 792 to work, it dont respond. All the other work. The LM4 start on 0, therefore all the adress i -1 {"product_code":"Swegon_Gold","mapping":[ { "name": "A-Alarm", "bus_datatype": "bool", "type": "discreteinput", "address": 12,"bus_address":27137}, { "name": "B-Alarm", "bus_datatype": "bool", "type": "discreteinput", "address": 13,"bus_address":27138}, { "name": "DX comp1", "bus_datatype": "bool", "type": "discreteinput", "address": 109,"bus_address":27139}, { "name": "DX comp2", "bus_datatype": "bool", "type": "discreteinput", "address": 115,"bus_address":27140}, { "name": "supply", "bus_datatype": "float16", "type": "inputregister", "address": 63, "value_multiplier": 0.01, "units": "C" ,"bus_address":27141}, { "name": "exhaust", "bus_datatype": "float16", "type": "inputregister", "address": 65, "value_multiplier": 0.01, "units": "C" ,"bus_address":27142}, { "name": "intake", "bus_datatype": "float16", "type": "inputregister", "address": 72, "value_multiplier": 0.01, "units": "C" ,"bus_address":27143}, { "name": "setpointt", "bus_datatype": "float16", "type": "register", "address": 131, "value_multiplier": 0.01, "units": "C" ,"bus_address":27144, "writable":1}, { "name": "Supply air", "bus_datatype": "float16", "type": "inputregister", "address": 36, "value_multiplier": 0.01, "units": "%" ,"bus_address":27145}, { "name": "Extract air", "bus_datatype": "float16", "type": "inputregister", "address": 37, "value_multiplier": 0.01, "units": "%" ,"bus_address":27146}, { "name": "Start/stopp", "bus_datatype": "float16", "type": "register", "address": 792,"bus_address":27149} ] } In the manual for the modbus it stand: 1x0013 A-alarm active Any alarm with priority class A active 1x0014 B-alarm active Any alarm with priority class B active 1x0110 COOL DX compressor 1 input Digital input status 1x0116 COOL DX compressor 2 input Digital input status 4x0793 Communication operation level 0=auto, 1=total stop, 2=low speed, 3=high speed, 4=normal stop, 5=extended normal stop. Is there som how now what I do wrong? RE: Modbus script - admin - 19.05.2016 You can try reading data from a resident script. Just make sure that you disable RTU in modbus mapper, otherwise it will not work. Also you need to change script parameters like port name, baud, slave id etc. Once script finishes you will see the result in Logs tab. Code: require('luamodbus') RE: Modbus script - oyvindnordbo - 20.05.2016 Thank you, I have try that, but when i go to the log the messige is: * arg: 1* nil* arg: 2* nil, what Is this mean? RE: Modbus script - zoltan - 21.05.2016 First rule when working with modbus devices - take a usb to rs485 converter (possibly isolated) and check addresses with modbus tester on laptop. Bus sniffing is also something worth learning, same as reading modbus without software decoder. Never take the documentation or the tech's word for granted - until the device responds to you via your laptop. I had situations when the documentation and the field tech both say'd the same, but in the end I made the changes in the 3rd party device SW to made it speak modbus. Address 4x0793 is modbus function 3 (read holding register). Are you sure it's configured correctly in LM? It can be confusing when the address is 4x for function 3 and 3x for function 4. |