Hello,
So I am receiving a signal from an outside source, that can turn on at random. If this signal is high, the robot should not move matter what button is pressed (MoveJ, MoveL, etc.), and if the robot is moving and that signal goes high, RS turns the signal off, and then continues to its target. Right now I can make the robot not move and also use an interrupt routine to do things if that signal goes high while the robot is moving. Unfortunately though, I am simulating that using 2 different signals, as I don’t want it to go to the interrupt routine every time the signal goes high, because depending on the state of the robot when that signal goes high, I need different things to happen… So my question is, is there a way to do 2 different things in a interrupt routine based on the state of the robot?
Here is my code that kind of helps explain my current scenario:
! While loop is constantly looping unless interrupt routine is active
! DO1 is if the signal goes high when the robot is stationary
! DO2 is if the signal goes high when the robot is moving
CONNECT sig1Int WITH IntRoutineDO2High;
ISignalDO DO2,1,sig1Int; ! If DO2 is high, jumps to interrupt routine (seen below)
TRAP IntRoutineDO2High
! Routine is active when the robot is moving and the DO2 is high
! Stops movement
! Sends message to server saying DO2 is high, turns DO2 off
! Continues path
StopMove\Quick;
Reset DO2;
SocketSend clientSocket\Str:=“DO2 was turned high while the robot was moving. Stopped movement and reset DO2”
WaitTime 2;
StorePath;
RestoPath;
StartMove;
ENDTRAP
PROC main()
…
i:=1;
While i=1 DO
…
IF DO1=1 THEN
SocketSend clientSocket\Str:=“DO1 is high, robot will not move until DO1 is off”
ELSE
MoveJ myRobotTarget,v150,z100,tool0\WObj:=wobj0;
ENDIF
…
ENDWHILE
…
ENDPROC
As seen in my code, I want what happens when DO1 and DO2 are pressed to happen, but use only 1 signal instead of 2 signals. Basically I want the interrupt routine to happen, but only if the robot is moving, otherwise just keep looping and checking the state of the DO if the robot is stationary. Any ideas?
Thanks for any help!
SM