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

"EWorkToolSwitch value invalid" error message on kuka from SWITCH statement

  • Darkhorse
  • June 13, 2023 at 10:07 PM
  • Thread is Unresolved
  • Darkhorse
    Trophies
    1
    Posts
    17
    • June 13, 2023 at 10:07 PM
    • #1

    Hi guys,

    I am trying to run the switch statement but getting EWorkToolSwitch value invalid message when stepping through. Can someone tell me what am I doing wrong here?

    FYI: WorkToolEnum defined at config.dat file this way

    "ENUM WorkToolEnum GetScrapTool,GetScrewTool,GetStapleTool,GetNailTool,LeaveScrapTool,LeaveScrewTool,LeaveStapleTool,LeaveCurrentTool,LeaveNailTool"

    Code:

    &ACCESS RVP


    &REL 834


    &PARAM DISKPATH = KRC:\R1\UserPrograms


    DEF  ToolChange (eWorkToolSwitch:IN )


    DECL WorkToolEnum eWorkToolSwitch


       ;FOLD INI;%{PE}


          ;FOLD BASISTECH INI


             GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )


             INTERRUPT ON 3


             BAS (#INITMOV,0 )


          ;ENDFOLD (BASISTECH INI)


          ;FOLD USER INI


             ;Make your modifications here


          ;ENDFOLD (USER INI)


       ;ENDFOLD (INI)


    GoHome()


    SWITCH eWorkToolSwitch


    ;-------------------------------------------------


      CASE #GetScrapTool


           ;CHECK IF THERE IS ANY TOOL PRESSENT AT TCU


           IF diScrewToolContact == TRUE THEN


              LeaveScrewTool()


           ENDIF


           IF diStapleToolContact == TRUE THEN


              LeaveStapleTool()


           ENDIF


           IF diNailToolContact == TRUE THEN


              LeaveNailTool()


           ENDIF


           ;TO PLC: ALARM TOOL MISSING


           WHILE (diScrapToolContact == FALSE) AND (bAllToolsDocked == FALSE)


                 Alarm(141)


           ENDWHILE


           ;CHECK IF SCRAP TOOL PRESENT AT TCU


           IF diScrapToolContact == FALSE THEN


              GetScrapTool()


           ENDIF

  • kwakisaki June 14, 2023 at 12:10 AM

    Approved the thread.
  • Hes
    Reactions Received
    42
    Trophies
    2
    Posts
    243
    • June 14, 2023 at 12:39 AM
    • #2

    code is incomplete.. one case and no end switch. Move the variable declaration to dat file or make another that you can monitor. And check what the variable is when reaching the switch. Most likely error is as message states, value invalid.

  • hermann
    Reactions Received
    407
    Trophies
    9
    Posts
    2,612
    • June 14, 2023 at 6:13 AM
    • #3

    And you must show the call of the program 'Toolchange', think you call it without a parameter. Should be something like Toolchange(#getscraptool)

  • Darkhorse
    Trophies
    1
    Posts
    17
    • June 14, 2023 at 12:25 PM
    • #4
    Quote from Hes

    code is incomplete.. one case and no end switch. Move the variable declaration to dat file or make another that you can monitor. And check what the variable is when reaching the switch. Most likely error is as message states, value invalid.

    Thanks for reply. The code is pretty long that's why shared only one case, I do have multiple cases and also endswitch at the end. I can declare a new variable in dat file, but how do I use it within the switch logic to debug? If you could send a sample code, would appreciate it.

  • Online
    panic mode
    Reactions Received
    1,280
    Trophies
    11
    Posts
    13,085
    • June 14, 2023 at 2:27 PM
    • #5

    the part of code shown looks ok. parameter is declared correctly and it looks like it is not initialized. that means call was incorrect. you need to provide parameter value. this can be done either by creating test program that calls it, or... one can also enter parameter value from menu (if manually calling the routine). finally, one can also use VARSTATE function to check if the variable is initialized.

    for example add something like this:

    Code
    IF VARSTATE("eWorkToolSwitch")<>#INITIALIZED THEN
       IF $MODE_OP==#T1 THEN
          ; display dialog and ask user to select state manually
       ELSE
         MsgNotify("eWorkToolSwitch has no value")
         RETURN
       ENDIF
    ENDIF

    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

  • Darkhorse
    Trophies
    1
    Posts
    17
    • June 15, 2023 at 12:30 PM
    • #6

    Thanks guys. Seems like initialization was the issue as you guys mentioned. PLC is responsible for sending the initialization values as you can see on this line.

    DEF  ToolChange (eWorkToolSwitch:IN )

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
  • KSS 8.3
  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