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

P0139 - Illegal Control Structure

  • PlasticBlaze
  • October 31, 2022 at 3:41 PM
  • Thread is Unresolved
  • PlasticBlaze
    Trophies
    1
    Posts
    3
    • October 31, 2022 at 3:41 PM
    • #1

    Hello,

    Definitely posted in the wrong spot before :fearful_face:

    I'm currently programming a palletizing robot for a project at my work. I'm not the most experienced but think I've picked up on it okay for not having been to a training or done one before. I'm running into a problem now in my structure or formatting of my program. I can post more of my program if needed to answer the question but the section below is where the error is being thrown. It actually says line 33 of the program which is the first 'CASE TRUE' but if I comment out the section in red (not sure if color formatting works inside the code section, but its the section inside the asterisks) the program runs fine. Can you not put an IF statement in a CASE X OF scenario?

    Regardless of this, what I'm working towards is to monitor the three pallet overall heights so that the movements can be lower if there are less boxes and then dynamically change as the pallets get built. Any help is appreciated.

    Code
    .PROGRAM pal1_pat1(); 
    ACCURACY 5 ALWAYS
    SPEED 1000 MM/S ALWAYS
    JMOVE #abovepal1_pat1
    POINT pal1_pat1 = #pal1_pat1
    palletHeight1 = BITS(1133,7)
    palletHeight2 = BITS(1140,7)
    palletHeight3 = BITS(1147,7)
    ztotal1 = BITS(1175,9)
    zshift1 = BITS(1230,9)
    layer1 = BITS(1163,4)
    row1 = BITS(1154,3)
    xshift1 = BITS(1202,9)
    POINT pal1_place1 = TRANS(xshift1*row1,0,ztotal1*layer1)+pal1_pat1
    SPEED 1000 MM/S ALWAYS
    ACCURACY 1 ALWAYS
    POINT pal1_place1 = SHIFT(pal1_place1 BY 0,0,zshift1)
    TWAIT 0.05
    JAPPRO pal1_place1,(ztotal1+100)
    SPEED 800 MM/S ALWAYS
    LMOVE pal1_place1
    SIGNAL 39 ;  TURN VACUUM OFF
    SWAIT 1039 ; VACUUM IS OFF
    LDEPART 100
    SIGNAL 61 ; Load1 Cnt
    ACCURACY 5 ALWAYS
    SPEED 1000 MM/S ALWAYS
    JMOVE #abovepal1_pat1
    SIGNAL -61 ; Load1 Cnt
    SPEED 700 MM/S ALWAYS
    JMOVE #place_approach
    5
    CASE TRUE OF
    VALUE SIG(1041):
    RETURN
    END
    CASE TRUE OF
    VALUE SIG(1042):
    CALL lane2
    END
    ;*****************************
    ;CASE TRUE OF
    ;VALUE SIG(1043):
    ;    IF palletHeight1>53 THEN
    ;        LDEPART 300
    ;        HOME 1
    ;        END
    ;    ELSE
    ;        HOME 1
    ;        END
    ;END
    ;*****************************
    CASE FALSE OF
    VALUE SIG(1041),SIG(1042),SIG(1043),SIG(1044),SIG(1045):
    GOTO 5
    END
    .END
    Display More
  • Go to Best Answer
  • ericwiz7923
    Reactions Received
    25
    Trophies
    3
    Posts
    194
    • October 31, 2022 at 9:00 PM
    • #2

    So is the issue with line 33 or the stuff you actually have commented out?

  • kwakisaki
    Reactions Received
    694
    Trophies
    12
    Posts
    4,770
    • October 31, 2022 at 10:33 PM
    • Best Answer
    • #3

    Have a look at your IF and cross reference with the AS manual, you will see where you are going wrong.

    Code
    IF
    END
    
    IF
    ELSE
    END
    
    IF.............GOTO label


    Code
    CASE x OF
       VALUE 1:
          IF
          ELSE
          END
       VALUE 2:
          IF
          END
       ANY :
     END

    View my channel at Industrial Robotics Consultancy Limited - YouTube

  • PlasticBlaze
    Trophies
    1
    Posts
    3
    • October 31, 2022 at 11:49 PM
    • #4

    Thank you all. I was able to figure it out at some point during the day.

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

Tags

  • AS language
  • Syntax
  • illegalcontrolstructure
  • formatting
  • case
  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