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 do I call routines in Karel code from the teach pendant job?

  • ashwinmudigonda
  • March 10, 2018 at 11:34 PM
  • Thread is Resolved
  • ashwinmudigonda
    Trophies
    3
    Posts
    43
    • March 10, 2018 at 11:34 PM
    • #1

    I have written a few programs that contain routines. How do I call a specific one from a program?

    For now, I have moved each routine into a separate program to access them.

    Is there a better way?

  • inusO
    Reactions Received
    1
    Trophies
    3
    Posts
    33
    • March 12, 2018 at 11:48 AM
    • #2

    Do you mean calling a routine from program B declared in program A?
    If so, you can simply import that routine calling its definition and adding FROM clause

    Code
    ROUTINE myroutine(arg1 : INTEGER) FROM programA
  • ashwinmudigonda
    Trophies
    3
    Posts
    43
    • March 12, 2018 at 3:19 PM
    • #3

    I meant on the teach pendant. I have a PROGRAM A in Karel. On the pendant when I do a CALL function, I see only Program A, not its subroutines.

  • rf103
    Reactions Received
    18
    Trophies
    4
    Posts
    264
    • March 13, 2018 at 9:39 AM
    • #4

    There is no support for this. Not even in Karel itself (see the documentation for CALL_PROG: "cannot be used to run internal or external routines").

    Technically this would be possible (as the binaries should provide all the information needed), but Fanuc hasn't made anything available that can do this.

    Perhaps you could use TP arguments and use a string argument to implement some kind of jump table in your main program.

  • bidzej
    Reactions Received
    23
    Trophies
    4
    Posts
    592
    • March 13, 2018 at 10:03 AM
    • #5

    ...or you could use separate Karel program, that would be called by the TP-program only to execute a routine of another Karel program, using the code provided by inusO (just 1 line of code).

  • rf103
    Reactions Received
    18
    Trophies
    4
    Posts
    264
    • March 14, 2018 at 11:38 AM
    • #6

    Yes, good suggestion. I missed that in inusO answer.

    Depending on how many routines you want to call from TP this could lead to many, many tiny programs though.

    Would be nice if CALL_PROG supported this, or Fanuc introduced a calling convention between Karel and TP. That way we could call Karel routines from TP directly.

  • nfmetal
    Trophies
    3
    Posts
    7
    • March 14, 2018 at 4:17 PM
    • #7

    Hi, this has been working for me.
    I created a MAIN.TP.

    1.CALL SAFEHOME <---------We created a "safehome" macro. Inside there are "home position" and outputs to PLC.
    2.LABEL[1]
    3.CALL SAFEHOME <--------------Before running the routine we call safehome, just want to be safe, probably don't need it.
    4.IF DO[102]=OFF JMP_LABEL[2] <----------Go to label 2 if signal 102 is off. (Yours might be different) 102 is a signal to PLC. (Push button)
    5.IF DO[102]=ON CALL SIDE_A <----------If signal 102 is ON then call "Side A". Inside the "Side A" we call side A program.
    6.WAIT DI[104]= OFF <------- Our PLC tells the robot to execute. we want to be sure the Di104 is Off. (Our robot sometime won't turn it off)
    7.LABEL[2]
    8.IF DO[103]=OFF JMP_LABEL[3] <----------Go to label 3 if signal 103 is off. (Yours might be different) 103 is a signal to PLC.
    9.IF DO[103]=ON CALL SIDE_B <----------If signal 103 is ON then call "Side B". Inside the "Side B" we call side B program.
    10.WAIT DI[105]=OFF <---------- we want to be sure the Di105 is Off.
    11.LABEL[3]
    12.[R1]=[R1]+1 <---------- Torch cleaner count
    13.IF [R1]<5 JMP LBL[99] <--------If register 1 is less then 5 jump to label 99
    14.WAIT 1 SECOND
    15.IF [R1]=5 DI[104] AND DI[105]OFF <--------If register 1 reach 5 and 104 and 105 is OFF
    16.CALL REAMER <----------Call the torch cleaning program. (Macro)
    17.[R1]=0 <---------- Reset torch cleaner count
    18.LBL[99]
    19.JMP_LABEL[1]
    END

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

Users Viewing This Thread

  • 1 Guest
  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