How change Unity-ID in TCP Modbus Slave

aso3964
2018-01-26
4 days ago
  • aso3964 - 2018-01-26

    Hello
    We are using Codesys V 3.5.10.50 on Raspberry PI model 3 to communicate with a Modbus RTU device through a Modbus TCP gateway.
    In the Slave configuration, itΒ΄s possible to define the Unity-ID address, besides the IP address and IP port of the TCP Gateway.
    However, the library only allows us to change the IP addresses and port, using the TCP-Slave.ComSettings function.
    Is there any way to swap Unity-ID via program???

    Sergio

     
  • john-hedges-ifm - 2019-05-31

    I would also like to know how this can be achieved.

    V3.5.11.0

    John

     
  • scoob

    scoob - 2022-07-27

    Did you ever find a solution to this? I am looking to perform the same thing.

     
  • husarz17 - 2026-03-31

    I need the same issue. In my application TCP server on raspberry (codesys) should have UnitID 1. But it only works when I am requesting with UnitID 255. And my application can't work with this parameters...

     
  • nulltrace - 2026-04-01

    Please explain how you configured that. Normaly, the Server should answer to all UID as long as gateway isn't activated. With activated gateway all UID will be forwarded to Serial-Interface, in taht case 255 has to be used for Gateway-Diagnostics.

    So that means, there is somethink wrong on your configuration.

    Which CDS-Version, Which Runtime-Version and so on are used.

     
  • husarz17 - 2026-04-01

    My codesys is 3.5.21.30. I am using function ModbusServer from library ModbusTCP_Slave. The reason is that I need share 9000 Holding registers. By standard configuration it is only 4096.

    fbMbTcpDevice: ModbusTCP_Slave.ModbusServer;
    fbMbTcpDevice(
        wPort := 502,
        pInputData := ADR(awInputReg),
        pOutputData := ADR(awHoldingReg),
        uiInputDataSize := 10,
        uiOutputDataSize := 9000,
        xEnable := TRUE,
        tTimeout := 10000,
        InterfaceName := "eth0",
        xBusy => xBusy,
        xError => xError,
        byClientConnections => byConnections
        );
    

    Ethernet port is cofigured:
    Network interface: eth0
    IP address: 10.10.22.55
    Subnet maskL 255.255.255.0
    Default gateway: 0.0.0.0

    And it only works when I am reading registers with ID 255 by Modbus Poll. Any other IDs don't work. The actual TCP client device try to read registers with ID 1 and I can't change it...

    Thanks in advance for your help!

     
  • nulltrace - 2026-04-03

    Hey Husarz,
    thanks for your Message, now i understand your Problem, also able to reproduce that. Pls. give me a Short Time to Check some stuff on this, i'll come back to this Topic with news ASAP.

    Greetings

     

    Last edit: nulltrace 2026-04-03
  • nulltrace - 2026-04-10

    Hey Husarz.

    i don't forget you, the Thing is, to give you my answer, i have to wait for Answer from Codesys/E. Schwellinger. i suspect Mr. Schwellinger is on in Vacations that week.

    so please, be patient at moment

     

    Last edit: nulltrace 2026-04-10
  • husarz17 - 4 days ago

    Hi nulltrace,
    Thanks for the info. I'm waiting to hear back from you.
    Take care!

     
  • nulltrace - 4 days ago

    Hey, I also waiting for feedback from Mr. Schwellinger
    @eschwellinger, please send me an answer, i would appreciate it.

    The clue is, i know the solution, but have to check if it's allowed to share.

     

Log in to post a comment.