Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

MODBUS:

corriibme
2022-08-08
7 days ago
  • corriibme - 2022-08-08

    From the example program for ModbusTCP

    // Configure the MODBUS TCP client
    client(aIPaddr:=server.aIPaddr, udiLogOptions:=(ModbusFB.LoggingOptions.ClientConnectDisconnect OR ModbusFB.LoggingOptions.ClientReceivedValidReplies));
    // Try to connect the client
    client(xConnect:=TRUE);

    After configuring and connecting the MBTCP client instance as shown, wouldn't a line like the following re-initialize the client object and terminate the connection? ...because it has just been stripped of the server's IP address and xConnect goes back to its default FALSE value.

    // Call the client to do request processing (handling state changes in ClientRequest's)
    client();

    I say this because that's exactly what happened (as expected) in a code I've been working on.
    Could you please provide some clarification?



    Talk Topic about project #codesys-example/modbus

     
  • corriibme - 2022-08-08

    I'm having this problem with my Modbus TCP master program: a successful connection is made to the server, to be used to read a number of input registers in sequence by using the ModbusFB.ClientRequestReadInputRegisters function block.

    But although the xExecute input is being controlled by a clock signal which turns it ON and OFF cyclically, no ModbusTCP request has ever been sent onto the physical ethernet medium. At the same time, I get no Error or Exception messages from any ModbusTCP function block. However, the ClientTCP.udiNumReqNotProcessed keeps rising, hinting at something called request starvation (at least according to the official documentation). Is there some extra action that I need to take to make the ModbusFB.ClientRequestReadInputRegisters FB send these requests out apart from setting appropriate values at its inputs and outputs?

    Thank you.

     

Log in to post a comment.