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. KUKA 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

Create subprogram & use it globally

  • zaidb
  • August 17, 2020 at 7:37 PM
  • Thread is Unresolved
  • zaidb
    Trophies
    2
    Posts
    10
    • August 17, 2020 at 7:37 PM
    • #1

    Hello,

    Excuse my newbie question. I have been looking for an answer everywhere but no success.

    What I'm trying to achieve:

    I would like to create multiple routines (startWelding, stopWelding etc) and use them globally in any file.I would like to, if possible, have all these routines in one single file

    My questions:

    1. Should it be a module, a function or an expert module?
    2. How can I define these routines globally to be used in any file?
    3. How can I access and use the subprogram from another file?
    4. How to debug a project that couldn't be deployed on to the controller(for example error in a .src file that stopped the deployment)?

    Looking forward for your answers.

    Zaid

  • panic mode
    Reactions Received
    1,267
    Trophies
    11
    Posts
    13,033
    • August 17, 2020 at 7:47 PM
    • #2

    you can place them all into one expert module, then replace each DEF or DEFFCT with GLOBAL DEF or GLOBAL DEFCT. see MsgLib.src for example

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • massula
    Reactions Received
    200
    Trophies
    8
    Posts
    1,421
    • August 17, 2020 at 7:52 PM
    • #3

    1. This depends on what is Your objective. Functions, for example, can return a value. But on most cases, a module will suffice.

    2. On some cases You need declare the routine as global, as GLOBAL DEF MyRoutine (). On other cases, You can just declare it normally, DEF MyRoutine()

    3. On other program, You just write MyRoutine ()

    4) Open the defective file on WorkVisual and see the error messages. KRL editor is going better with newer versions, so it probably will warn You on the right spot.

    And, about Your other questions, yes, You can have all Your subroutines on the same file, and on some scenarios, this is the best way to proceed, since You will have a single library to manage.

  • zaidb
    Trophies
    2
    Posts
    10
    • August 18, 2020 at 12:47 PM
    • #4

    Thank you panic mode and massula for your answers!

    Have a nice day

  • Koppel
    Reactions Received
    19
    Trophies
    3
    Posts
    132
    • December 21, 2022 at 9:09 AM
    • #5

    KSS 8.7 on a KRC5 micro.

    The robot complains that this Syntax is a problem and does not even let me open the file. Not even outside the KRC:\R1 folder


    When I try to copy the file to R1 folder, it says

    "File format not correct (header syntax).... "
    Originator: ReadHeader()

    I delete the GLOBAL and everything is fine.

    Code
    GLOBAL DEF OpenGrip ( )
    PULSE (PleaseOpenGripper, TRUE, 3600)
    WAIT FOR GripperOpen
    PleaseOpenGripper = FALSE
    END


    So how do I create small programs that can be called from larger programs globally?

  • panic mode
    Reactions Received
    1,267
    Trophies
    11
    Posts
    13,033
    • December 21, 2022 at 2:08 PM
    • #6

    The FIRST routine in any SRC file is always global. Do not add keyword GLOBAL to it. This is only needed for other routines in the same file.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Koppel
    Reactions Received
    19
    Trophies
    3
    Posts
    132
    • December 21, 2022 at 3:23 PM
    • #7

    Thank you. This was not immediately clear.

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
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • 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
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Tags

  • KUKA
  • KRC4
  • KRL
  • subprogram
  • global
  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