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

Soft Motion function block stuck on busy

samw
2022-12-30
2023-01-02
  • samw - 2022-12-30

    I created a subroutine that supposed to swing an axle back and forth but for some reasons the first MoveRelative function block always stuck on Busy and keep turning until I set the input (the Var Swing) from the main program (PLC PRG) to false. The second MoveRelative FB will then run but it won't pass the '.Done' variable to the first FB and start the process again.

    I just want to spin a motor axle back and forth continously until a trigger/input from the main program to stop it. I can only use Soft Motion Light as I do not have hard real time or RTE. I hope someone can point out what I did wrong. Many thanks!

     
  • Fless

    Fless - 2022-12-30

    Hi,
    the problem is in the way you set the Execute inputs.
    Done gets reset when you disable Execute.

    Take a look at the help and the signal figure of the example
    https://content.helpme-codesys.com/en/libs/SML_Basic/Current/PLCopen/MC_MoveRelative_SML.html

     
    πŸ‘
    1
    • samw - 2023-01-02

      Thank you for the example Fless, is the example using CFC? How do I keep it in a continuous loop? I still can't get rid of the issue with the MoveRelative Function Block stuck on busy, it seems if any contacts linked to execute is high the FB will always stuck on busy even when no power is going through the line.

       
      • hermsen

        hermsen - 2023-01-02

        Hi,

        The best advice I can give you is to follow a introductory PLC programming course. This course will allow you to get familiar with the available programming languages, how to interpret them and similarities/distinctions between them. The course will hopefully also explain the handling of the generic (PLCOpen) Execute / Busy / Done / Error / ErrorID mechanism.

        Such a course may be found on Lynda or similar or you could invest in a good book like "The book of CODESYS" which also explains these topics very well.

        Some hints about the FB state machine;
        Busy will stay TRUE until a specific input and/or internal condition of the FB has been met. After this the FB state will either go to Done or Error (with the according ErrorID). To reset the FB for a new "job", just feed it a falling and rising Edge on Execute. During execturion, Busy will be TRUE, when the FB has fininished, the status of the FB will be Error/Done.

         
        πŸ‘
        1

        Last edit: hermsen 2023-01-02
        • samw - 2023-01-02

          Thank you Hermsen for the detailed explanation. I have took some time to review some courses and I'll go deeper on the subject when I have the time.

          The hint that you have given:

          Busy will stay TRUE until a specific input and/or internal condition of the FB has been met. After this the FB state will either go to Done or Error (with the according ErrorID). To reset the FB for a new "job", just feed it a falling and rising Edge on Execute. During execturion, Busy will be TRUE, when the FB has fininished, the status of the FB will be Error/Done.

          This is how I think the state machine works too but if you look at the attached photo of my first post I have sent a falling edge signal to the Execute input but the FB remained on Busy state. The motor just keep on spinnng in one direction until I flip the input variable in the main program(PLC PRG) to false. This is very confusing because in the subroutine one of the contact is still open. How did the FB sense the state change of a variable in the main program while the input is not connected.

           

Log in to post a comment.