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

Problem with COM_MOD_MAST in AC500!

occam
2012-04-04
2013-01-11
  • occam - 2012-04-04

    Hi all!
    I'm having a hard time using the MODBUS RTU interface on the AC 500 and would appreciate any hint:
    The application is running several programs (POUs) written in ST.
    Program A (cyclic, priority 20, @ 500 ms) implements a set of synchronization flags and CASE statement used to select different Modbus requests and feed them to the COM_MOD_MAST block in program B and set the event triggering program B.
    Program B (event triggered, priority 10) basically consists of a COM_MOD_MAST block and some synchronization logic to notify program A that the request is processed.
    So far everything runs fine, but when I cut the RS485 connection to any/all of the MODBUS slaves DONE and ERR in the COM_MOD_MAST are not affected, and regardless of the TIMEOUT parameter the COM_MOD_MAST gets executed immediately (I measured the time before and after the COM_MOD_MAST it's < 1 ms). When I set a breakpoint at the statement containing the COM_MOD_MAST the DONE and ERR parameters are set correctly, but at the next statement they are gone. I tried assigning DONE and ERR to global variables:

    MBTxRq(EN:= TRUE,
          COM := 2,
          SLAVE := MBSlaveDvADR,
          FCT := FunctCode,
          TIMEOUT := MB_COMM_TOUT,
          ADDR := MBSlaveRqAddr,
          NB := MBRxLngth,
          DATA := MBRxDataAdr,
          DONE => Mod_Done,
          ERR => Mod_Error,
          ERNO =>Mod_ErrNum
    );
    

    without success. Waiting for MBTxRq.ERNO to get nonzero was no help either.
    Even using F_TRIG/R_TRIG available in the library in order to capture ERR and DONE was no cure.
    The manual says: "After completing or aborting the processing (due to an error), DONE is set to TRUE for one cycle." - no idea what does cycle mean in this case?!?!
    Thnx in advance!

     
  • flaendsdal - 2013-01-11

    occam hat geschrieben:
    The manual says: "After completing or aborting the processing (due to an error), DONE is set to TRUE for one cycle." - no idea what does cycle mean in this case?!?!

    You have to do then check for DONE and ERR in program B.
    a Cycle in this case is at then from fiste time it hit COM_MOD_MASTER to then then next time..

    Flændsdal

     

Log in to post a comment.