LM as Modbus Slave. datatype and offset - 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: LM as Modbus Slave. datatype and offset (/showthread.php?tid=3030) |
LM as Modbus Slave. datatype and offset - ikhy - 27.11.2020 Hi! I ask for your help, I am a beginner. I am using LM as Slave via script. When I try to write an integer value in my PLC to an integer register (uint16 in LM), I cannot do it. But if I write a floating point value to this register, then an integer value is written. When I test in Modbus Poll, I have the status “illegal data address” Slave LM. is it an offset problem? What should I do? RE: LM as Modbus Slave. datatype and offset - Daniel - 27.11.2020 It might help if you show us the slave script. RE: LM as Modbus Slave. datatype and offset - ikhy - 27.11.2020 Code: if not mb then changed nothing RE: LM as Modbus Slave. datatype and offset - Daniel - 27.11.2020 You have done everything correct here. I assume the objects 3/1/1 and 3/1/2 are 2 byte unsigned integer? RE: LM as Modbus Slave. datatype and offset - admin - 27.11.2020 Which address are you using from ModBus side? You can only use 0 and 1 because you have 2 registers defined. RE: LM as Modbus Slave. datatype and offset - ikhy - 27.11.2020 (27.11.2020, 10:11)admin Wrote: Which address are you using from ModBus side? You can only use 0 and 1 because you have 2 registers defined.yes. use 0 and 1 registers immediately after connecting to LM and I can write data from Modbus Poll. But from one type PCL i can not. and from other type PLC I can only when I write float (27.11.2020, 10:09)Daniel. Wrote: You have done everything correct here. I assume the objects 3/1/1 and 3/1/2 are 2 byte unsigned integer?yes I think maybe my controller starts reading not from 0, but from 16 bits. therefore, he understands part of the float as integer. And i need to do offset. is it possible? RE: LM as Modbus Slave. datatype and offset - ikhy - 27.11.2020 please, can you test this script in some Modbus Server? do you get an "illegal data address" too? "illegal data address" : The data address received in the query is not an allowable address for the server (or slave). More specifically, the combination of reference number and transfer length is invalid. RE: LM as Modbus Slave. datatype and offset - Daniel - 27.11.2020 This script was used in many projects and nobody had this issue. Try reading register 1. RE: LM as Modbus Slave. datatype and offset - ikhy - 27.11.2020 yes-yes! i totally agree with you. i see how many people use it. i only want to understand where is my issues. i can read and write values via modbus server but with errors. RE: LM as Modbus Slave. datatype and offset - Daniel - 27.11.2020 The issue is somewhere in config of your PLC. PS. LM is modbus server here, your PLC is client. RE: LM as Modbus Slave. datatype and offset - ikhy - 27.11.2020 (27.11.2020, 13:22)Daniel. Wrote: The issue is somewhere in config of your PLC.yes! it was PLC issues. Thank you for the help! |