Universal Modbus TCP/RTU Slave - 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: Universal Modbus TCP/RTU Slave (/showthread.php?tid=4288) |
RE: Universal Modbus TCP Slave - rw_echo - 14.03.2023 (14.03.2023, 06:18)admin Wrote: holdingregisters = registers, you need to use inputregisters instead. I tried to change "registers" to "inputegisters", but it still doesn't work. I disabled and then re-enabled the resident script, but the address mapped by "inputegister" still doesn't work. This is the changed code: Code: mb.setmapping({ In addition, I want to implement the knx address' 1/1/1 'to' 1/1/100 'to map the continuous list of registered addresses [0] to [100]. Now I need to write 100 mapping statements to implement it. Is there a fast implementation method? RE: Universal Modbus TCP Slave - admin - 14.03.2023 Check that the name is exactly inputregisters, you have the name misspelled twice in your post. RE: Universal Modbus TCP Slave - Fahd - 14.03.2023 (14.03.2023, 07:39)rw_echo Wrote:(14.03.2023, 06:18)admin Wrote: holdingregisters = registers, you need to use inputregisters instead. ChatGPT will be fast enough Code: inputregisters = { RE: Universal Modbus TCP Slave - admin - 14.03.2023 There was a bug with input registers in the library. Use updated code from the first post and restart the resident script afterwards. RE: Universal Modbus TCP Slave - rw_echo - 14.03.2023 (14.03.2023, 08:15)admin Wrote: Check that the name is exactly inputregisters, you have the name misspelled twice in your post. I did make two errors in my post, but I checked that the "inputegisters" in the code were correct. I saw that there is no relevant description of "inputegisters" in the user library 'mbtcp' script in Daniel's post. Is "user. mbtcp" missing the command statement of "inputegisters"? RE: Universal Modbus TCP/RTU Slave - batistacaceres - 06.06.2023 I have tried to connect one LogicMachine ModbusRTU as Slave, and another LogicMachine ModbusRTU as Master (using profiles), and it doesnt word, then I have tested using one LogicMachine ModbusTCP as Slave, and another LogicMachine ModbusTCP as Master (using profiles), and it works, very well. I have connected both Logicmachine using interface RS485-1 (A-A, B-B) The code I am using is: local mb = require('user.mbslave') local mbrtu = require('luamodbus').rtu() mbrtu:open('/dev/RS485-1', 115200, 'E', 8, 1, 'H') mbrtu:connect() mbrtuetslave(1) -- '*' handles multiple RTU slave IDs mb.setmapping({ --[slave ID = 1] [1] = { coils = { [0] = '32/0/13', -- On/Off Luces Dpto. Técnico [1] = '32/0/113', -- Estado On/Off Luces Dpto. Técnico }, registers = { [0] = '32/2/24', -- Luminosidad Dpto. Técnico [10] = '32/2/23', -- TConsigna AACC Dpto.Técnico [11] = '32/2/123', -- Estado TConsigna AACC Dpto.Técnico } } }) mb.setswap('w') mb.setfloat16precision(2) while true do mb.rtuhandler(mbrtu) end Am I doing something wrong?, Anybody have tested it? best regards RE: Universal Modbus TCP/RTU Slave - Daniel - 06.06.2023 Yes this script was fully tested, make sure you use correct interface and settings are same on master and slave. RE: Universal Modbus TCP/RTU Slave - batistacaceres - 06.06.2023 (06.06.2023, 14:18)Daniel Wrote: Yes this script was fully tested, make sure you use correct interface and settings are same on master and slave. Hello admin: Yes, I have used correct interface and settings are same on master and slave. In error log, it show me the next: User library mbslave:432: attempt to call method 'send' (a nil value) stack traceback: User library mbslave:432: in function 'rtuhandler' bestregards Roger RE: Universal Modbus TCP/RTU Slave - admin - 06.06.2023 Install 2023 firmware release. RE: Universal Modbus TCP/RTU Slave - batistacaceres - 06.06.2023 (06.06.2023, 15:34)admin Wrote: Install 2023 firmware release. yes, yes, yes, now it works.... thank you very much.. best regards Roger RE: Universal Modbus TCP/RTU Slave - pioneersteffen - 11.06.2023 Hi LM Team, Many thanks for suppling this scripts! They work perfectly. One question: - How can I define a register with a permanent INT16 value = 6? So don‘t use a group-address as source of the register. Many thanks for your help! Best Regards Steffen RE: Universal Modbus TCP/RTU Slave - admin - 12.06.2023 Such feature is not implemented. You can simply use a virtual object for this. RE: Universal Modbus TCP/RTU Slave - khalil - 09.07.2023 Hello Dears, Has any one integrate UPS NETMAN 204 TCP/IP . Datasheet attached RE: Universal Modbus TCP/RTU Slave - pioneersteffen - 09.07.2023 Hi @all, I want to connect a Kostal Smart Energy Meter to the universal Modbus Slave running on LM. Unfortunately I do not know right now what registers the Energy Meter expects to run correctly. Is there any possibility to log/which registers the Energy Meter is requesting/polling from universal Modbus Slave on LM? Many thanks for your help! Best regards Steffen RE: Universal Modbus TCP/RTU Slave - Erwin van der Zwart - 09.07.2023 No, without documentation of registers and data type used by the devices it’s hardy possible and guessing what registers is used for what.. So you need this documentation … RE: Universal Modbus TCP/RTU Slave - pioneersteffen - 09.07.2023 Hi Erwin, many thanks for the quick reply. I having a documentation what registers generally existing, but I don‘t know which one are getting polled. If I would know this I could make a match. Any ideas with this additional information? Many thanks! Best regards Steffen RE: Universal Modbus TCP/RTU Slave - Erwin van der Zwart - 09.07.2023 That depends on your script or profile, there you set the registers that you want to read/write and is matching the registers described in your device document.. RE: Universal Modbus TCP/RTU Slave - Daniel - 19.07.2023 Not the best thread to place this question as this is slave script topic where you need modbus profile. Please create separate Thread. RE: Universal Modbus TCP/RTU Slave - djaval - 24.02.2024 Hi! Please clarify how to change datatype of holdingregister from integer to float16 or 32? Float temperature value by default is converted to integer x100. How to change it to float ? RE: Universal Modbus TCP/RTU Slave - Daniel - 26.02.2024 This is how it meant to work. You need to convert it back to float on master device. mb.setfloat16precision(2) sets how float16 is converted to integer. By default it's 2 decimals (0.01 precision). Change 2 to 0 to convert to integer without any decimals. |