Writing Homeout Routine using an Interrupt

  • Below is some sample code, I am just looking at how to successfully pull off full homeout using an interrupt.

    Currently it doesn't fully reset the program. Even though I am doing so in the SPS. It returns to the main and tries to start moving from where it left at.

    More of what I am asking is how to I get it to fully stop and never go back to the Main.

    Should I ramp stop the robot at the end of its homeout routine and wait for the PLC signal of reset prg?


    Thanks,


  • So I just sent the snippet. This is some code that has compiled and has been running for over two years now. If you want me to post all of the code I can.

  • I'm not worried about the code "running" because it already has been. I am more concerned about the homeout routine when using an interrupt and how it doesn't reset the program fully. Then it just goes back into the program and tries to run from where it left.

  • well it is interesting that it does not concern you if anyone can afford to invest time and effort to piece together what ever this jumble of code snippets is.

    please read pinned topic READ FIRST.


    and please explain what you mean. i have never heard of "does not reset program fully". reset program means moving instruction pointer to first program instruction. either it is there or not, there is no "part way reset". you also mentioned MAIN() program, not sure what that is or how it fits into what you are trying to do. also there is missing endloop and end switch etc.


    my suggestion is to present it as if it is a school test question. that way there has to be only ONE way to interpret it.

    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

  • I don't know what "Homeout" does or is supposed to, but I assume you want program pointer to go to the line after "Interrupt on 4".


    It should be enough to end Homeout with "Resume" and to put everything starting with

    Code
    ;FOLD PTP P15 VEL=100 % PDAT1 TOOL[1]:PPEOAT BASE[4]:I/O;%{PE}%R 8.3.48,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:P15, 3:, 5:100, 7:PDAT1
    
    $BWDSTART=FALSE
    PDAT_ACT=PPDAT1
    FDAT_ACT=FP15
    BAS(#PTP_PARAMS,100)


    in a separate procedure.

  • Here is the full text file. What I mean by it doesn't reset fully is it only resets sometimes. It will work here and there, but not consistently. "Homeout" is for the robot to homeout from where it is at. I didn't write this code, so to me it is also a jumble to figure it out. I am trying to improve it. In the program binary values are set at certain points, and when the homeout interrupt happens, homeout subprogram looks at the binary value and does moves to get home. Then it is supposed to reset the program. Instead it will go back to the program and give a reposition error. If I add resume it will start back from where it left. I do not want it to do that. I want it to reset the program once it homes out. I am getting the reset prg bit from the plc, but for whatever reason it only works here and there. If you need anymore information let me know. I am not trying to be vague. I am trying to be straight to the point.


    Thanks.

  • you still say that you want "reset" but did not explain:

    1. what is it exactly that YOU consider by "reset successful".

    2. you say it will "go back to program" and "sometimes works". any help here?


    if you are not using RESUME and robot does not go back to path, you WILL get reposition error and program will crash. there is NO way around it.


    if you want program to move robot to some position that is not on present path, you have two options:

    a) use RESUME and after reaching main program exit it or go to specific part.

    b) use CWRITE to stop/reset/cancel robot program


    btw. this HOMEOUT is vastly different from what you posted originally.

    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

  • "Homeout" is for the robot to homeout from where it is at.

    Double thumbs up for using the word you are defining in it's definition. But seriously, I know what homing, to go home, to home in on smth means, but never encountered "to homeout". Google isn't providing anything useful in that regard. Is this a common name for some specific procedure?

    Looking at the full code it looks a lot like robot going to home position depending on the state of the cell.


    From the code you posted, I don't understand how the program reset would sometimes work at all.

  • My bad panic mode. 1. So I want the program to reset, so it closes the program and opens it at the beginning and starts from the beginning. 2. So the interrupt routine will take the robot home and then once its home it jumps back into the main operating program. I have never learned the resume command or have used it in a practical application. Everything I read about the RESUME makes it sound like when I put that into an interrupt specifically my interrupt I will go home then go back into the program and try to go to whatever position I was at when I left. Any example code on CWRITE? And this HOMEOUT isnt different. I just posted a small snippet of the beginning of the subprogram. Mentat I say homeout, because that is our common language in our shop. The robot goes home thats what I mean by homeout. Do you want to see the code in my SPS file?

  • From the manual:

    "RESUME cancels all running interrupt programs and subprograms up to the level at which the current interrupt was declared."


    This means that if your work motions are inside a procedure, you can use RESUME to jump to before that procedure.


    Be mindful of advance run pointer, as RESUME puts them both after the line at witch interrupt is declared. Easily solvable with a few "wait sec 0" :smiling_face:

  • Hello. Do you try and stop the robot first in your interrupt routine with HALT statement? I think from your description that during the robot movement you cant just cancel or reset the program(like if you have robot in EXT, you cant just press reset program during program execution, must put it to T1... before press program stop, robot stops, then you can reset program and back to EXT, same way applies from trying to reset from program in EXT mode, just you dont have to put in T1, but robot must stop first) ... You have to stop the robot movement first, that is why you describing that sometimes it works sometimes not...

    I already did this some time ago also, just have to find the code...

  • Hello. Do you try and stop the robot first in your interrupt routine with HALT statement? I think from your description that during the robot movement you cant just cancel or reset the program(like if you have robot in EXT, you cant just press reset program during program execution, must put it to T1... before press program stop, robot stops, then you can reset program and back to EXT, same way applies from trying to reset from program in EXT mode, just you dont have to put in T1, but robot must stop first) ... You have to stop the robot movement first, that is why you describing that sometimes it works sometimes not...

    I already did this some time ago also, just have to find the code...

    Yes, in the homeout subroutine there is a BRAKE at the beginning. Should I use HALT or BRAKE after every XHOME move? I understand what you are saying, I only have one project under my belt so I am relatively new to this. So, trying to fix someone else' mistakes is not my strong-suit yet.

    Thanks!

  • In think in my program, i'm not using BRAKE and RESUME, just use HALT and set flag and in the sps i carry out the restart procedure when the flag is set... will check


    Example:


  • i would go with what Mentat offered though that would require restructuring code (something this program really could use), but stopping robot, setting flag and letting sps do the rest works too.

    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

Advertising from our partners