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

Auto Select Program on Start Up?

  • dlanhart
  • May 16, 2024 at 12:15 AM
  • Thread is Unresolved
  • dlanhart
    Reactions Received
    4
    Trophies
    1
    Posts
    16
    • May 16, 2024 at 12:15 AM
    • #1

    Hello all, I was wondering if there is a way to auto select a program in the event of a power loss/restore? For example, I am in my PICK program when power loss occurs and I want to get back to my MAIN program when power is restored. Thanks!

  • kwakisaki
    Reactions Received
    694
    Trophies
    11
    Posts
    4,760
    • May 16, 2024 at 9:14 AM
    • #2

    You've already asked about a variation of this process in an earlier thread with cycle start turning off......so what is the difference except for the condition.....???

    Simply:
    - Set system switch to turn on an autostart.pc program(s).
    - Set conditions/commands to use in the autostart.pc.
    - The autostart.pc program(s) will execute on power up.

    Code
    .PROGRAM autostart.pc();
    	MC PRIME main,1,1;
    .END

    You could also include subroutines within the autostart.pc routine and also variable states to monitor for as these states will be retained (programmatically) at the point of power loss, power cycle periods.

    Using this method though, uses up a background task, for a single purpose.
    So it's all about deciding on the most efficient way of using autostart programs on power up and during running.
    That's where real understanding of just how the controller operates in terms of sequencing, functions available, understanding the full AS language commands available to use and logical programming implementation all relative to the application.

    There is no definitive way as many variations exist and each application is different:
    - Control from a PLC to use dedicated signals, pg(x) naming convention and RPS system switch.
    - Control from a standalone robot controller, pg(x) naming convention and RPS system switch.
    - Control from a standalone robot controller without requiring any external influences.

    I would look into as a point of reference:
    - System switch usage and functionality.
    - MC Commands.
    - SWITCH commands for monitoring of dedicated system conditions.
    - SYSDATA command function and usage.
    - WHICHTASK (not available in C controller) and TASK commands and usage.
    - Argument (parameter parsing) through CALL instruction.
    - Explore dedicated signals, pg(x) naming and RPS usage if using a PLC for the control.

    The above are what are used most often used when it comes to constructing complex autostart routines.

    View my channel at Industrial Robotics Consultancy Limited - YouTube

  • dlanhart
    Reactions Received
    4
    Trophies
    1
    Posts
    16
    • May 16, 2024 at 9:26 PM
    • #3

    I have come up with a solution, that fits my team's specific needs, and this was the work around:

    1. Our autostart.pc program was not declared correctly, this was the correct syntax:

    Code
    .PROGRAM autostart.pc()
    .END
    
    ; was previously...
    
    .PROGRAM autostart()
    .END

    2. We needed our MAIN program to run on power up so we added to autostart.pc:

    Code
    .PROGRAM autostart.pc()
      WAIT SWITCH(POWER )
      MC EXECUTE main
      10
      	; other functionality
      GOTO 10
    .END

    Thank you kwakisaki for the input, you are correct with how I outlined the conditions for returning to MAIN using cycle start as the indicator in my previous thread. After digging into the weeds more for this project, the solution above works best for what we are needing now.

  • kwakisaki
    Reactions Received
    694
    Trophies
    11
    Posts
    4,760
    • May 17, 2024 at 12:16 AM
    • #4

    That would work in it's literal state, I would recommend a TWAIT before the GOTO though.
    - for example TWAIT 0.004.

    However that is easily broken by:
    - Power up controller.
    - Select teach mode for manual jogging.
    - Turn on motor power.
    - PC Task would generate an error as it will try and execute main program which it can't.
    - PC Task will abort due to this error.

    Not knowing your application and just how you plan to control - local or remote from PLC etc.

    There are some things to consider further as you develop but by no means a golden rule.
    You can make PC Tasks as simple as you choose, or elect to go very complex.
    So a couple of hints but by no means any kind of 'must do':
    - Try and use PC Tasks for cyclic scanning (like a PLC) so you can do multiple functions.
    - Try and avoid WAIT and SWAIT as these will stop the scanning until the conditions are met.
    - Try and monitor for Teach and Repeat Modes so to separate functions applicable to mode(s).
    - A simple example below.
    - This is not a final solution as several other conditions should be monitored for.

    Code
    .PROGRAM autostart.pc();
    ;
      MC PRIME main,,1;
    ;
    Loop:
    ;
    ; =====> repeat mode <=====
    IF (SWITCH(REPEAT)==TRUE) THEN;
      IF (SWITCH(CS)==FALSE) THEN;
        IF (SWITCH(POWER)==TRUE) THEN;
          IF (TASK(1)==2) THEN;
            MC CONTINUE;
          ELSE;
            IF (SYSDATA(MSTEP)<>-1) THEN;
              MC EXECUTE main,,1;
            ELSE;
              MC PRIME main,,1;
            END;
          END;
        END;
      END;
    END;
    ; =====> teach mode <=====
    IF (SWITCH(REPEAT)==FALSE) THEN;
      ;xxxxxxxxxx
    END
    ;
    ; =====> Goto label <=====
    TWAIT 0.004
    GOTO loop;
    ;
    .END
    Display More

    View my channel at Industrial Robotics Consultancy Limited - YouTube

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • October 24, 2024 at 2:09 AM
    • #5

    Hi, since I found this topic I thought it would be interesting to ask some questions this way other people can benefit from it. I've been trying to learn and understand the basics of AS language and with plenty of help from Kwakisaki, I have managed to accomplish almost everything I need for my application. I am working with a C40 controller, what I wanted was being able to select and execute programs from teach pendant or externally via physical I/O , without the need to type in Execute, Hold, abort, kill, etc.......and that's exactly what we managed to do, Kwakisaki was extremely supportive and provided me an example o a task that is scanning continuously similar to the one above, and it is exactly what I need but there is only one problem, even if it works perfectly fine in simulation mode, when I am using the same code on the real controller it's not doing anything , what I mean by that is, even if all the buttons are displayed on the Interface Panel, they don' respond in any way when pressed. I have the internal signals enabled, it looks like it doesn't respond to the MC instruction or I am not understanding the exact issue.

    At startup, the autostart.pc is running, I can see it on the teach pendant

    When I press start, clear, hold, from I/P nothing happens

    If I press the physical button on the controller Motor on, the following error is displayed: ERROR (-324) Cannot execute with MC instruction, No=1001 ,

    Once the error appears the task stops automatically.

    Any ideas?

    Code
    .INTER_PANEL
    1,5,"   Error"," "," "," ",6,0,2001
    2,5,"  Repeat"," "," "," ",4,1,2002
    3,1," ","   Start","   Robot"," ",4,2,2006,0
    4,1," ","   Pause","   Robot"," ",4,2,2007,0
    7,6,"  Program","    No.",1,0,-1,2010,2,0,3,1,0
    8,1," ","   Clear","  Program"," ",4,2,2008,0
    9,5,"   MPower"," "," "," ",3,0,2003
    17,5,"   Servos"," "," "," ",3,0,2004
    25,5,"   Cycle"," "," "," ",4,0,2005
    .END
    .PROGRAM autostart.pc()
    again:
    ;
    ;===========================================
    ; Set IFP lamps to reflect status
    ;===========================================
    ;
      IF SWITCH(ERROR )==TRUE THEN
        SIGNAL 2001
      ELSE
        SIGNAL -2001
      END
    ;
      IF SWITCH(REPEAT )==TRUE THEN
        SIGNAL 2002
      ELSE
        SIGNAL -2002
      END
    ;
      IF SWITCH(POWER )==TRUE THEN
        SIGNAL 2003
      ELSE
        SIGNAL -2003
      END
    ;
      IF SWITCH(RGSO )==TRUE THEN
        SIGNAL 2004
      ELSE
        SIGNAL -2004
      END
    ;
      IF SWITCH(CS )==TRUE THEN
        SIGNAL 2005
      ELSE
        SIGNAL -2005
      END
    ;
    ;===========================================
    ; Hold Robot from button
    ;===========================================
    ;
      IF ((SIG(2007)==TRUE) AND (SWITCH(CS )==TRUE) AND (SWITCH(RGSO )==TRUE)) THEN
        MC HOLD
        WAIT ((SWITCH(RGSO )==FALSE) AND (SWITCH(CS )==FALSE))
      END
    ;
    ;===========================================
    ; Interrupt and Clear Program Stack
    ;===========================================
    ;
      IF SIG(2008)==TRUE THEN
        MC HOLD
        WAIT ((SWITCH(CS )==FALSE) AND (SWITCH(RGSO )==FALSE))
        BITS 2010,2 = 1
        MC KILL
      END
    ;
    ;===========================================
    ; Start or Continue Robot from button
    ;===========================================
    ;
      IF SWITCH(REPEAT )==TRUE THEN
        IF ((SIG(2006)==TRUE) AND (SWITCH(CS )==FALSE) AND (TASK(1)<>1)) THEN
          IF SWITCH(POWER )==FALSE THEN
            MC ZPOWER ON
            WAIT SWITCH(POWER )==TRUE
          END
          IF TASK(1)==2 THEN
            MC CONTINUE
          ELSE
            IF TASK(1)==0 THEN
              MC PRIME pg0,1
              WAIT TASK(1)==2
              MC EXECUTE
            END
          END
        END
      END
    ;
      TWAIT 0.0016
      GOTO again
    .END
    .PROGRAM pg0()
    ;
      HOME
    ;
      prod.no = BITS(2010,2)
    ;
      CASE prod.no OF
       VALUE 1:
        CALL pg1
       VALUE 2:
        CALL pg2
       VALUE 3:
        CALL pg3
       ANY :
        HALT
      END
    ;
      HOME
    .END
    .PROGRAM pg1()
      JMOVE #p1
    .END
    .PROGRAM pg2()
      JMOVE #p2
    .END
    .PROGRAM pg3()
      JMOVE #p3
    .END
    Display More
  • kwakisaki
    Reactions Received
    694
    Trophies
    11
    Posts
    4,760
    • October 24, 2024 at 5:37 AM
    • #6

    When posting error codes, please also provide STEP NO. of program.

    In case main program error using either KRTerm (online) or MFP keyboard type in at prompt > or $
    STATUS and press enter.

    In case pc task error using either KRTerm (online) or MFP keyboard type in at prompt > or $
    PCSTATUS 1: and press enter.

    These will display status information and also step no at which error occurs.

    So we need step no. where MC error occurs, that will open the door to troubleshoot issue.
    Otherwise we are blind.

    Is PC Task running in PC Task area and not in Program area?

    On IFP panel, do your lamps indicate status change:
    - Repeat lamp, if you toggle teach/repeat switch does lamp light for repeat position.

    Using KRTerm or keyboard, if you type in IO and press enter, this will display status of IO.
    So when pressing input buttons on IFP, do signals 200x display change of state.

    What are your dedicated input and output signals set to in aux functions dedicated inputs and outputs.

    View my channel at Industrial Robotics Consultancy Limited - YouTube

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • October 24, 2024 at 5:45 AM
    • #7

    The PC task is running in PC task area, in the program area is nothing shown, I will check and answer all the other questions as soon as I will get there, thank you

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • October 24, 2024 at 12:22 PM
    • #8

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • October 24, 2024 at 12:25 PM
    • #9

    The teach repeat lamp updates until the error apeares

    Edited once, last by marianflow (October 24, 2024 at 1:53 PM).

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • October 24, 2024 at 12:29 PM
    • #10


    Initially the teach/repeat lamp did update on the I/F, it also got to the POWER on stage but immediately the error occurred when it got to a certain stage: step No. 71 as it shows above .

    Edited once, last by marianflow (October 24, 2024 at 1:51 PM).

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • October 24, 2024 at 2:03 PM
    • #11

    also step 54 from what I see


    My dedicated input signals are set to

    30 EXT_CYC_START

    31 EXT_ERR_RESET

    32 EXT_MTRON

    but I am not using them at the moment, same with the dedicated outputs. I am only using internal for now, and they do update util the error

    Images

    • image.png
      • 9.05 kB
      • 757 × 87
      • 2

    Edited once, last by marianflow (October 24, 2024 at 2:15 PM).

  • kwakisaki
    Reactions Received
    694
    Trophies
    11
    Posts
    4,760
    • October 24, 2024 at 6:42 PM
    • #12
    Code
    ;
    ;===========================================
    ; Interrupt and Clear Program Stack
    ;===========================================
    ;
      IF SIG(2008)==TRUE THEN
        MC HOLD
        WAIT ((SWITCH(CS )==FALSE) AND (SWITCH(RGSO )==FALSE))
        BITS 2010,2 = 1
        MC KILL
        SWAIT -2008;*************************;
      END
    ;
    ;===========================================
    ; Start or Continue Robot from button
    ;===========================================
    ;
      IF SWITCH(REPEAT )==TRUE THEN
        IF ((SIG(2006)==TRUE) AND (SWITCH(CS )==FALSE) AND (TASK(1)<>1)) THEN
          IF SWITCH(POWER )==FALSE THEN
            MC ZPOWER ON
            WAIT SWITCH(POWER )==TRUE
          END
          IF TASK(1)==2 THEN
            MC CONTINUE
          ELSE
            IF TASK(1)==0 THEN
              MC PRIME pg0,1
              WAIT TASK(1)==2
              SWAIT -2006;*************************;
              MC EXECUTE
            END
          END
        END
      END
    Display More

    Insert the two SWAIT modifications as above and let me know what happens?

    View my channel at Industrial Robotics Consultancy Limited - YouTube

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • October 25, 2024 at 1:48 PM
    • #13

    Hi, same error on MC Prime, is there anything that I was supposed to enable from OPTIONS?

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • October 26, 2024 at 4:25 PM
    • #14
    Code
    .PROGRAM autostart.pc()
    ;
    again:
    100
    IF SWITCH(REPEAT )==TRUE THEN
    IF ((SIG(2006)==TRUE) AND (SWITCH(CS )==FALSE) AND (TASK(1)<>1)) THEN
    IF SWITCH(POWER )==FALSE THEN
    MC ZPOWER ON
    SWAIT -2006;
    IF SWITCH(POWER )==FALSE THEN
    GOTO 100
    END;
    WAIT SWITCH(POWER )==TRUE
    IF TASK(1)==2 THEN
    MC CONTINUE
    ELSE
    IF TASK(1)==0 THEN
    SWAIT -2006;*************************;
    MC EXECUTE main,,1;
    END;
    END;
    END;
    END;
    END;
    ;
    Display More


    if I am trying this simplified way , without MC Prime, it does work just fine

  • kwakisaki
    Reactions Received
    694
    Trophies
    11
    Posts
    4,760
    • October 26, 2024 at 5:47 PM
    • #15

    With your MC PRIME command, just use:
    MC PRIME pg0

    View my channel at Industrial Robotics Consultancy Limited - YouTube

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • October 27, 2024 at 4:37 PM
    • #16

    Strange issue, it does the same for MC KILL :thinking_face:

    It looks like PRIME and KILL are not included in the list, it is probably for newer controllers after C-type

    Edited 3 times, last by marianflow (October 27, 2024 at 5:08 PM).

  • kwakisaki
    Reactions Received
    694
    Trophies
    11
    Posts
    4,760
    • October 29, 2024 at 7:26 PM
    • #17
    Quote from marianflow

    It looks like PRIME and KILL are not included in the list, it is probably for newer controllers after C-type

    I doubt that as those were available in the earlier AD Controllers.

    Very strange.

    What happens if you just create a PC task which contains 1 step:
    MC PRIME pg0 and then PCEXECUTE it?

    Make a full file save and post it and I'll have a look over it.

    View my channel at Industrial Robotics Consultancy Limited - YouTube

  • ShAdOwDrAgOnS
    Reactions Received
    37
    Trophies
    3
    Posts
    64
    • November 5, 2024 at 2:20 AM
    • #18
    Quote from kwakisaki

    With your MC PRIME command, just use:
    MC PRIME pg0

    MC PRIME pg0,,1 will work if you want to prime it at line 1.

    You may want a slight delay after confirming the main motion routine is killed before you prime or execute another motion routine.

  • marianflow
    Reactions Received
    1
    Trophies
    1
    Posts
    21
    • November 8, 2024 at 1:16 AM
    • #19

    Right, so.. it looks like MC used with PRIME it's literally missing from syntax or something, I've tried the simplest program possible and it's not able to do anything 😕 if I send PRIME pg0 from keyboard it does work but it doesn't like it with MC for some reason, strange problem. I even created a autostart.pc where there is only MC PRIME pg0 .... just one scan and the same error, I've added delays before and after IF conditions, wierd thing.. , If you have any other suggestions please let me know.

  • kwakisaki
    Reactions Received
    694
    Trophies
    11
    Posts
    4,760
    • November 8, 2024 at 5:26 AM
    • #20

    That's a first for me.................:icon_eek:

    Via the built in keyboard or via KCWin/KRTerm, if you type in:
    help/mc and press enter.

    What is returned on the screen?
    That should produce a list of the commands that are available for use with MC instruction.
    If PRIME is not there, then that will answer this issue.

    The alternative (you've already discovered) is to use the MC EXECUTE.

    There is also another option you could explore (which is a longer route) and that is to use the built in RPS option and external program reset input to prime pg0 but this route does include a PC Task control to accomplish this.

    View my channel at Industrial Robotics Consultancy Limited - YouTube

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

Similar Threads

  • Software Request to KUKA - the robot forum bugs and wish list

    • Werner Hampel
    • August 17, 2019 at 10:37 AM
    • KUKA Robot Forum
  • R538 Ethernet/IP I/O Adp installed? Do I have to activate the option in some hidden menu?

    • Leonel97
    • April 24, 2024 at 5:21 PM
    • Fanuc Robot Forum
  • Any suggestion how to resolve KSS01205 Ackn.: Interpolation cycle timeout monitoring LRS_HP issue

    • Aivaras Narbutas
    • September 11, 2023 at 3:43 PM
    • KUKA Robot Forum
  • R-30iA Hidden Auto Start Program

    • triviaMaster
    • July 19, 2022 at 2:09 PM
    • Fanuc Robot Forum
  • Beginner questions

    • robotecnik
    • July 7, 2022 at 12:31 PM
    • Fanuc Robot Forum
  • Roboguide questions

    • robotecnik
    • July 26, 2022 at 3:01 PM
    • Fanuc Robot Forum
  • Cancel Program and Send Pointer to Cell.

    • PGG
    • August 31, 2017 at 10:40 PM
    • KUKA Robot Forum
  • AUT EXT: PGNO declarations help? [SOLVED]

    • n0909
    • April 3, 2018 at 8:27 AM
    • KUKA Robot Forum
  • rj2 backup problem

    • aytac balaban
    • March 19, 2021 at 7:32 AM
    • 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