Welcome, Guest. Please login or register.
Did you miss your activation email?
February 09, 2012, 07:02:28 AM
Home Help Login Register
News: Any Problems or Experience with Industrial Robots ?
Register and place your Question / Answer to worldwide Robotexperts right here !

+  Robotforum | Support for Robotprogrammer and Users
|-+  Industrial Robot Help and Discussion Center
| |-+  KUKA Robot Forum (Moderators: Werner Hampel, Martin H, SkyeFire)
| | |-+  Problems with Interrupt for return to Home Position (There isn't another topic)
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Problems with Interrupt for return to Home Position (There isn't another topic)  (Read 694 times)
Tiago_Tre
Newbie
*
Offline Offline

Gender: Male
Posts: 12



« on: August 23, 2010, 10:48:44 PM »

Hi!

I've read all topics about interrupts, but nothing about this error:

When interrupt 6 is called, this error occurs: 1388 - M VARIABLE WRITE PROTECTED IN LINE 415 MODULE BAS

(BAS is BAS.SRC)
Below is the program code (the problem happens only with the interruption 6):

;Program Called by MAIN( )
DEF entrada_injetora( )
INI
INTERRUPT DECL 6 WHEN $IN[19]==TRUE DO saida_injetora ( )
interrupt decl 5 when injetora_auto==false do msg_alarmes ( )
interrupt on 5
...
...
...
$advance=0
INTERRUPT ON 6
PTP ;Only for example
PTP
PTP
PTP
PTP
PTP
...
...
...
INTERRUPT OFF 6
INTERRUPT OFF 5

END


;INTERRUPT PROGRAM:
;OBS.: This is an Expert Module, don't have INI (with INI occurs anothers similar errors)
DEF saida_injetora( )
INTERRUPT OFF 6
PTP
PTP
PTP
PTP
PTP
MAIN( )


Please help me!!! My head will explode soon

Thanks!
Logged
Domonoky
Newbie
*
Offline Offline

Posts: 11


« Reply #1 on: August 24, 2010, 12:30:53 PM »


I am not sure, but i think you should not call main() from the interrupt.

I would guess that main() calls something from bas.src which wants to modify some variables which are write protected in interrupts.
Logged
Tiago_Tre
Newbie
*
Offline Offline

Gender: Male
Posts: 12



« Reply #2 on: August 24, 2010, 01:03:57 PM »

Hi Domonoky,

I tried to remove the main () and nothing changes. The problem occurs as soon as I call interruption and not during it... 
Logged
SkyeFire
Global Moderator
*****
Offline Offline

Posts: 1627


« Reply #3 on: August 24, 2010, 01:45:19 PM »

If you perform a Fold-Open on the PTP commands inside your SAIDA_INJETORA program, I suspect you'll find that each one contains a BAS call.  I'm betting that you created these moves using the standard inline form, yes?  You'll probably need to hand-code those moves in raw KRL.

And as an aside, Domonoky is entirely correct -- calling MAIN() from inside the interrupt service routine which was called from MAIN is entirely wrong.  When SAIDA_INJETORA finishes, the program pointer will move back to the step at which it left MAIN.

Logged
Probo.dk
Newbie
*
Offline Offline

Gender: Male
Posts: 27


« Reply #4 on: August 24, 2010, 10:32:02 PM »

Like SkyeFire - it seems it'll return to where it left - towards end...

why not a simple loop command in "main"?

And - to do those moves - just declare them in your sub's - always easy to find - easy to adjust - and easy to point to...
furthermore easy to "add" movements to - depending on your data...

"finetuning" those "on the move" is also a walk in the park - you can just put a simple ptp movement - and "call" your points afterwards...
Logged
Tiago_Tre
Newbie
*
Offline Offline

Gender: Male
Posts: 12



« Reply #5 on: August 24, 2010, 10:50:26 PM »

Hi SkyeFire and Domonoky,

Thanks for all!  dance2

Today I did several tests and came up with a solution.

Difficulties encountered:
1 - In interrupt, $POS_ACT PTP movement is performed correctly but when I add a PTP Px this failure occurs (Because the BAS call in the fold of PTP);
2 - The objective is to deactivate the interrupt subprogram (entrada_injetora (enters the injector)) and run a subprogram to return to Home position (saida_injetora (exits the injector)). But as mentioned by Domonoky, when call MAIN( ) in a subroutine several errors occurs.

Solution found:
Inside the interrupt is only a BREAK and set a Flag indicating the interruption was called. In the program entrada_injetora there is a GOTO soon after the moves PTP that jump to end of the subprogram, and thus returns to the program MAIN( ). Aaaand in the main program I read the Flag and call a subprogram for the movements PTP to return Home Position.  

;Program Called by MAIN( )
DEF entrada_injetora( )
INI
INTERRUPT DECL 6 WHEN $IN[19]==TRUE DO saida_injetora ( )
interrupt decl 5 when injetora_auto==false do msg_alarmes ( )
interrupt on 5
...
...
...
$advance=0
INTERRUPT ON 6
PTP ;Only for example
IF Flag==TRUE THEN
  GOTO END_PROG
ENDIF
PTP
IF Flag==TRUE THEN
  GOTO END_PROG
ENDIF
PTP
IF Flag==TRUE THEN
  GOTO END_PROG
ENDIF
PTP
IF Flag==TRUE THEN
  GOTO END_PROG
ENDIF
PTP
IF Flag==TRUE THEN
  GOTO END_PROG
ENDIF
PTP
IF Flag==TRUE THEN
  GOTO END_PROG
ENDIF
...
...
...
INTERRUPT OFF 6
INTERRUPT OFF 5
END_PROG: ;THIS IS THE LABEL CALLED BY GOTO

END


;INTERRUPT PROGRAM:
;OBS.: This is an Expert Module, don't have INI (with INI occurs anothers similar errors)
DEF saida_injetora( )
INTERRUPT OFF 6
BREAK
PTP $POS_ACT
Flag=TRUE
;END


;MAIN PROGRAM
...
...
...
entrada_injetora( )
IF Flag==TRUE
 return_Home_P( )
Flag=FALSE
ENDIF
...
...
ENDLOOP
END

;return_Home_P PROGRAM
DEF return_Home_P( )
INI
PTP
PTP
PTP
PTP
...
...
...
PTP
END

And this is all, folks!

Best regards!
« Last Edit: August 24, 2010, 11:01:03 PM by Tiago_Tre » Logged
SkyeFire
Global Moderator
*****
Offline Offline

Posts: 1627


« Reply #6 on: August 25, 2010, 01:22:19 PM »

Just some observations:

In SAIDA_INJETORA, I think that's supposed to be BRAKE, not BREAK.  And I believe you will need to add a RESUME command.  Otherwise, If INTERRUPT 6 is triggered while the robot is moving from Point A to Point B, after finishing the SAIDA_INJECTORA routine, the robot will complete the move to Point B before evaluating FLAG, which could lead to a collision.  Adding a RESUME command to the interrupt routine will "break" the motion taking place in ENTRADA_INJETORA at the moment the Interrupt was triggered.

The PTP $POS_ACT command seems unnecessary.  I'm not sure why you have it there

Having motion-command Folders inside an Interrupt routine is not allowed, obviously.  But you can program motions inside SAIDA_INJETORA, as long as you don't use the standard Folds.  Instead, if you have the E6POS or E6AXIS positions set up in the .DAT file of this module, you can simply use LIN P1, or PTP P1.  Or, you could use relative-motion commands, like LIN_REL {Z 500}, which would move the robot straight "up" (normally) along the Z axis of the active Base.

Logged
Tiago_Tre
Newbie
*
Offline Offline

Gender: Male
Posts: 12



« Reply #7 on: August 26, 2010, 01:20:09 AM »

Hi!

Hmmm, i don't say BRAKE? hehehe

The PTP $POS_ACT was passed over after the tests and I did not remove.

About RESUME, I consider there is no problem in completing the last movement of movements are extremely short and the Interrupt intention is not to avoid a collision, is to abort a program.

Thanks a lot!!!
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!