1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. Fanuc Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

How to use RUN Instruction

  • doublewai
  • March 16, 2020 at 9:26 PM
  • Thread is Unresolved
  • doublewai
    Reactions Received
    1
    Trophies
    2
    Posts
    45
    • March 16, 2020 at 9:26 PM
    • #1

    I'm trying to use "RUN" instruction to execute programs simultaneously.

    I'm not sure that when the "RUN" program ends.

    Example)

    Main program

    PROC0001

    1: J P[1] 100% CNT100

    2: J P[2] 100% CNT100

    3: RUN PROC0002

    4: L P[4] 500mm/sec CNT 100

    5: L P[5] 500mm/sec CNT 100

    END

    Does PROC0002 program end as same time as PROC001? (sub program PROC0002 waits for Main program PROC0001 to be finished?)

    or do they finished their own programs independantly?

    Thanks

  • HawkME
    Reactions Received
    570
    Trophies
    11
    Posts
    3,269
    • March 16, 2020 at 10:13 PM
    • #2

    They finish independently.

  • doublewai
    Reactions Received
    1
    Trophies
    2
    Posts
    45
    • March 16, 2020 at 10:23 PM
    • #3

    HawkME.

    Thanks for the replay,

    I do have other questions regarding to independant execution.

    If I use looping logic (JMP LABEL) on sub program PROC0002, does it keep running even though Main program PROC0001 is already ended?

    if sub program PROC0002 take more time to finish than main program PROC0001, and PROC0001 is looping, does sub program PROC0002 finish its program and then start again, interrupt then start again, or error?

  • TitusLepic
    Reactions Received
    113
    Trophies
    7
    Posts
    442
    • March 16, 2020 at 11:06 PM
    • #4

    First answer: Yes.

    Quote from Karel Reference Manual

    Once a child task is created, it runs independently of its parent task, with the following exception:

    • If a parent task is continued and its child task is paused, the child task is also continued.

    • If a parent task is put in STEP mode, the child task is also put in STEP mode.

    Second answer depends on if PROC0002 has motion. If there's no motion group assigned, PROC0001 will create another instance of PROC0002 that will run simultaneously with both PROC0001 and your first instance of PROC0002. This will probably give you unexpected results and also puts you at risk for a stack overflow. If there is a motion group assigned, you'll get a "Run request failed Already locked by other task" error. You can use flags or semaphore to control execution of multiple programs.

  • doublewai
    Reactions Received
    1
    Trophies
    2
    Posts
    45
    • March 17, 2020 at 1:54 PM
    • #5

    TitusLepic

    Thanks for the explanation

    to All

    Thanks for the help

  • Robo_Eng_13
    Reactions Received
    26
    Trophies
    4
    Posts
    432
    • March 18, 2020 at 6:59 PM
    • #6

    General explanation, more generalized in programming context.

    RUN and CALL are two different ways of executing programs.

    RUN is Non-Blocking, CALL is Blocking.

    RUN will, so long as there is no reason not to, create a new "thread", order it to execute the specified program, then move on and never look back.

    CALL will also run the specified program, but instead it will run it in the same "thread", waiting until the child program is completed to jump back to the line after the CALL command.

    As was said before, a motion group cannot ever be controlled by two programs at once, so whatever program you run must have a non-overlapping group mask to all other running programs, including the one in which the RUN command is executed.

    Also mentioned, CALLs within CALLs and RUNs within RUNs are always a hazard and likely to result in Stack Overflow or Memory Overflow, especially when loops are involved.

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • krc5
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • krc5
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Similar Threads

  • type of termination

    • Moises
    • September 21, 2019 at 7:48 AM
    • Fanuc Robot Forum
  • Shifting problem

    • alex1793
    • February 25, 2020 at 3:58 PM
    • Yaskawa Motoman Robot Forum
  • FOR-instruction

    • Runis86
    • May 7, 2018 at 8:23 AM
    • Fanuc Robot Forum
  • Explicit Messaging between R30iB and OMRON PLC

    • Famous_Fella
    • March 12, 2020 at 10:24 AM
    • Fanuc Robot Forum
  • Third party camera vision system

    • Kabi
    • September 12, 2018 at 11:36 PM
    • Fanuc Robot Forum
  • How to run two robot in same controller together ????

    • sanjay bisht
    • March 3, 2020 at 12:56 PM
    • Fanuc Robot Forum
  • Actual motion speed much higher than programmed motion speed when J6 rotation dominates motion

    • mts04a60
    • February 21, 2020 at 5:51 PM
    • Fanuc Robot Forum
  • Fanuc Continue program while moving

    • laurens.deprez
    • August 10, 2019 at 11:12 PM
    • Fanuc Robot Forum
  • Fanuc R2000ib teach pendant

    • bbjoday
    • September 9, 2016 at 9:36 PM
    • Fanuc Robot Forum
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download