Author Topic: Programming a signal interrupt  (Read 166 times)

0 Members and 1 Guest are viewing this topic.

Offline alpadolmeri

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
Programming a signal interrupt
« on: August 10, 2018, 07:24:05 AM »
Hello guys !
I need your help. I am working on a Kawasaki D-Series and I need to enable and disable an interrupt on my source code.
In fact, I need to monitor signal of a vaccum after I pick the piece. Until I disable the interrupt, if I have the piece on the arm I need to stop immediately the working if I loose the vacuum signal and call an escape routine. I was not able to find an example how to do it with AS.
Can you help me ?

Thanks to all.

Aldo

Offline Alexandru

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 7
  • Posts: 134
Re: Programming a signal interrupt
« Reply #1 on: August 10, 2018, 07:46:05 AM »
Hello,

you can do something like this:

.PROGRAM autostart.pc ()
begin:
  IF (flagobiect==1 AND SIG(-1037)) THEN
    SIGNAL 2036
  END
  IF SIG(2036) THEN
      MC HOLD
      TWAIT 1
      MC ZPOWER OFF
      $msg7 = "Object lost."
      flagobiect = 0
  END
TWAIT 0.1
GOTO begin
END

.PROGRAM motion ()

instructions
pick the object
flagobiect = 1
....
....
instructions
....
....
place the object
flagobiect = 0

.END

replace signal 1037 with your own signal number. If the robot dropped the object is up to you how you want to continue.

Offline alpadolmeri

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
Re: Programming a signal interrupt
« Reply #2 on: August 10, 2018, 07:55:39 AM »
Thank you very much for your suggestion. I will try it on monday .
Thanks ! :icon_wink:

Offline Kawaguy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 10
  • Posts: 37
Re: Programming a signal interrupt
« Reply #3 on: August 10, 2018, 08:12:26 AM »
You are looking for the ONI function.

  ONI signalnr CALL subprogram

or

  ONI signalnr GOTO label

Cancel the interrupt with:
 
  IGNORE ABS(signalnr)


Be careful when using ÓNI .. CALL ..

When the subprogram is completed, the program returns from the step where the interrupt came, which is most of the times not desired, especially if there are motion commands in the subprogram.

Personnaly I only use the ONI .. GOTO .. or I use the method from Alexandru, with a pc-program.