Interrupt Trap routine.
Hello everyone! I'm doing a school project that consists of a virtual em physic simulation of an ink producing machine made by me in this video:
https://youtu.be/G26clvVVUpo
The project will be carried out with a siemens S7 300 PLC and an ABB irb-140 ROBOT. I have a digital input associated with an interrupt that executes a TRAP routine.
When the plc sends a signal to this DI, it activates a TRAP routine, inside this routine, the robot stops. After stopping I have 2 conditions associated with 2 more inputs that wait for 1 signal from the plc.
One input makes the robot continue the process in the same place where the interrupt was activated, so far so good! When I activate the other digital input, I want the robot to go to another position (home position), and not return to the position where the interrupt was activated, following a new signal (start), restarting the whole process from the beginning .
What am I doing wrong? Someone can help me?
Thanks.
Bruno Santos.
Portugal.
https://youtu.be/G26clvVVUpo
The project will be carried out with a siemens S7 300 PLC and an ABB irb-140 ROBOT. I have a digital input associated with an interrupt that executes a TRAP routine.
When the plc sends a signal to this DI, it activates a TRAP routine, inside this routine, the robot stops. After stopping I have 2 conditions associated with 2 more inputs that wait for 1 signal from the plc.
One input makes the robot continue the process in the same place where the interrupt was activated, so far so good! When I activate the other digital input, I want the robot to go to another position (home position), and not return to the position where the interrupt was activated, following a new signal (start), restarting the whole process from the beginning .
What am I doing wrong? Someone can help me?
Thanks.
Bruno Santos.
Portugal.
0
Answers
-
Give the System input StartMain. Be careful that you do not crash the robot. At the top of your main program add a homing routine that can determine where the robot is and safely return it to home, then resume the program as I suppose you have normally been doing.Lee Justice0
-
Sorry, but I don't understand what you're trying to say. I added an ExitCycle, it happens that the PP enters the main and the program is stopped. I have to reconnect the controller/simulator manually. I send part of my code, I try to understand where the error is.
««VAR num CICLOS:=3;VAR intnum INT_EMERG_STOP;PROC MAIN()StartMove;LOOP:WaitDI START,1;MoveJ Target_10_2,v1500,z50,MyTool\WObj:=wobj0;SET EMERG_OUT;SET ENABLE_OUT;IDelete INT_EMERG_STOP;!! INTERRUPT EMERGENCIACONNECT INT_EMERG_STOP WITH INTERRUPT_EMERG_STOP;iSignaldi EMERG_STOP_IN,1,INT_EMERG_STOP;IF MISTURA_A=1 THENTPWrite "EXECUTAR MISTURA A";ARRANQUE;PEGAR_FERRAMENTA_MIST_A;WHILE START=1 DOMISTURA_A_ESQUERDA;Set CONT_PEÇA;WaitTime 0.5;Reset CONT_PEÇA;WaitTime 0.5;ENDWHILETPWrite "A FINALIZAR PROCESSO";LAVAGEM;PEGAR_FERRAMENTA_MIST_A;RECUO;ENDIFIF MISTURA_B=1 THENTPWrite "EXECUTAR MISTURA B";ARRANQUE;PEGAR_FERRAMENTA_MIST_B;WHILE START=1 DOMISTURA_B_DIREITA;Set CONT_PEÇA;WaitTime 0.5;Reset CONT_PEÇA;WaitTime 0.5;ENDWHILETPWrite "A FINALIZAR PROCESSO";LAVAGEM;PEGAR_FERRAMENTA_MIST_B;MoveJ Target_50,v1500,z5,MyTool\WObj:=wobj0;RECUO;ENDIFGOTO LOOP;ENDPROCTRAP INTERRUPT_EMERG_STOPVAR robtarget posição;StopMove;StorePath;posição:=CRobT(\Tool:=MyTool\WObj:=wobj0);MoveL Offs(posição,0,0,100),v100,z0,MyTool\WObj:=wobj0;MoveJ Target_50,v1500,z5,MyTool\WObj:=wobj0;WaitUntil CONTINUAR=1 OR RESTART=1;IF CONTINUAR=1 THENMovej Offs(posição,0,0,100),v1500,z0,MyTool\WObj:=wobj0;Movel posição,v100,z0,MyTool\WObj:=wobj0;RestoPath;StartMove;ENDIFIF RESTART=1 THENIF MISTURA_A=1 THENLAVAGEM_RESTART;PEGAR_FERRAMENTA_MIST_A;RECUO;ExitCycle;RETURN ;ELSEIF MISTURA_B=1 THENLAVAGEM_RESTART;PEGAR_FERRAMENTA_MIST_B;MoveJ Target_50,v1500,z5,MyTool\WObj:=wobj0;RECUO;ExitCycle;RETURN ;ENDIFENDIFRETURN ;ENDTRAP
»»0 -
First I have to ask, iSignaldi EMERG_STOP_IN, INT_EMERG_STOP are those for an actual Emergency stop? If so, then that is a big No-No. E-stops must be hardwired into the robot's safety circuit.Lee Justice0
-
Yes I know. But let's say it's a process stop/pause button.0
-
So you have not explained the undesired behavior which you say is your error.Lee Justice1
-
OK, I'll try to explain it better...
The DI "EMERG/STOP", will activate an interrupt with a TRAP routine.
After entering the routine, I have 2 options to choose: Continue the program from the place where the interrupt happened, or restart the robot program, that is, return or should return to the "home position" and wait for a new start signal to start the process from scratch.
Before placing the command "EXITCYCLE", after reaching the home position, the robot returns to the point where the interrupt was made, to finish the process that was interrupted. After I placed the "EXITCYCLE" command, the PP goes to main as intended, but the simulation does not continue and stops, and it is necessary to click play again!
All my code is working the way I want it, with the exception of the restart option part...Thanks.0 -
According to the RAPID reference manual ExitCycle will continue with the program execution if the run mode is in continuous, if it is in single cycle then it will stop...
0 -
That is how ExitCycle is supposed to work. It is for use when a fatal, non-recoverable error, in which the programmer sees no safe way to resume, so the program must return to the beginning. If you are not in continuous cycle mode, it will be stopped, if in continuous mode, it will be running.
StartMain system input, as I suggested before should put you to the beginning of the main program, with the program running, regardless of continuous mode or not.Lee Justice0 -
In continuous cycle? The program or the simulation? Because I had to put a "GOTO..." at the end of main so that the program is cyclic...
"Start main system input... " Do I have to write something at the beginning of Mai, or just configure in the controller that an X input, makes a set to the startmain function? Sorry, I'm still learning robotics. As far as I know, it's still basic. We just don't learn when we don't try to do it.
0 -
As shown in the snip from RobotStudio you change the run mode from single cycle to continuous - on the Rapid tab.
On a real controller this is in the quick set menu on the pendant.0 -
Esta opção?0
-
Type your comment0
-
graemepaulin said:According to the RAPID reference manual ExitCycle will continue with the program execution if the run mode is in continuous, if it is in single cycle then it will stop...
0 -
Does the program stop at the end of the main procedure without the GOTO?
Are you running the program from the Rapid tab or as a simulation?
0 -
If as a simulation then you need to change the run mode in the simulation setup as below
0 -
graemepaulin said:Does the program stop at the end of the main procedure without the GOTO?
Are you running the program from the Rapid tab or as a simulation?0 -
The ExitCycle will work if the run mode is in continuous mode.
You only have to change the mode in the simulation config if you are running the program from there.
The system input is configured in the IO configuration, you need an input signal to connect with it.
0 -
OK. And is it necessary to write something in rapid? Or is the controller already automatically configured that whenever "di_test" is at 1, it automatically starts main?0
-
Normally this is used by the PLC to start program execution at main.
I have never used it like this but Lee was suggesting to use it and he has much more programing experience than me...
When the input goes to 1 (high) the system input will try to start the program execution from main.
To get the input to change you will probably need to cross connect an output to the input used for the system input...
0 -
I already changed the simulation mode to continuous, now everything is working OK, but now another question has arisen. At the school I study, the robot abb irb-140 has a problem in the communication protocol, due to a file being corrupted. To program the robot through robotstudio, we have to put the files with the .mod e.pgm extensions on a flash drive and load them to the robot from there. I now ask: Even if I change the robot cycle to continuous in the flexpendant of the real robot, will everything work fine in reality? Because in addition to simulating with software, everything needs to work in reality! Thanks.0
-
Also to note with StartMain, the program must not be executing. The PLC must issue the Stop system input, then StartMain when the execution has stopped. I advise changing the system parameter under the controller topic, RUN_MODE_SETTINGS, ManualToAuto, continuous. Also, it makes it more user friendly to change AutoToManual to Single.Lee Justice0
-
Thank you! It's working perfectly! Now we just need to know if the program will work on a real robot.0
-
Yes it will work as it does in RobotStudio if you change the real robot to continuous run mode.
0 -
Thank you so much!
0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings