taskCreateSync error

  • Hi everyone, I have a question about taskCreateSync, there is the start() program where the synchronous task is declared, within this synchronous function there is the following code, but there is no modification in the worked string. The general idea would be to make an interruption, but from what I was studying there is only a way to do this through a synchronous task, which in this case is not working either, from my point of view, the task is run only once, which would be the role from a normal task.
    pls help me



    start()

    begin


    userPage("pgHMI")

    _sCycleStatus="Initializing..."



    taskCreateSync "myInterruption",1,bIsLate,syncTask()

    //call configdat()


    while true

    D01=false

    _sCycleStatus="Move Pick"

    movej(pPick1,tTool,mNomSpeed)

    waitEndMove()

    _sCycleStatus="Move Place"

    movej(pPlace1,tTool,mNomSpeed)

    waitEndMove()


    D01=true

    endWhile


    ###############
    syncTask()

    begin



    if D01==true

    //stopMove()

    sString="robot off"


    else

    sString="robot on"

    endIf


    end



    end

  • Place your Ad here!
  • Hi,

    The manual description:


    This instruction creates and starts a synchronous task.

    The execution of the task starts with the call of the specified program with the specified parameters. It is not possible to use a local variable for a parameter passed by reference, to make sure that the variable is not deleted before the task is completed. A runtime error is generated if the system doesn't have enough memory to create the task, or if one or more parameters are invalid.

    For a detailed description of synchronous tasks (see chapter 5.5).


    Example

    Code
    // Create a supervisor task scheduled every 20 ms
    taskCreateSync "supervisor", 0.02, bSupervisor, supervisor()


    I believe first of all the scheduled time if too big, you are requesting the task to run at least every second.

    Code
    taskCreateSync "myInterruption",1,bIsLate,syncTask()


    Also, your task is not looping, this means that once finished it won't run again.


    Try with above and let me know how it goes...

  • Hello,

    As EIEsgalho say, you need a loop in the program's task to keep it alive.


    But you don't need a synchronous task to realize an interrupt, you can make it with a normal task if you don't need to know the exact polling time.

    To Stop the robot with an Input, a normal task is enought.


    Have a good day,

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners