# AUTO / MAN mode best practices

**URL:** <https://tech-community.robotics.abb.com/t/auto-man-mode-best-practices/8302>\
**Category:** RobotStudio\
**Tags:** robotstudio, rapid-code, rapid, trap, interrrupts\
**Created:** [June 11, 2018, 9:10pm UTC](https://tech-community.robotics.abb.com/t/auto-man-mode-best-practices/8302 "2018-06-11T21:10:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexRad](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@AlexRad](https://tech-community.robotics.abb.com/u/AlexRad)\
**Post date:** [June 11, 2018, 9:10pm UTC](https://tech-community.robotics.abb.com/t/auto-man-mode-best-practices/8302/1 "2018-06-11T21:10:25Z")

</div>

Hello,

I am putting together a IRB 140 robot system with an indexing table.Everything is going to be controlled from a control panel, a PLC being master and the robot slave. There are two operating modes: AUTOMATIC and MANUAL (control panel switch).  
Each of the two procedures (AUTO / MAN) works fine on its own, however I am having trouble coding them to work together.Specifically, I have tried putting them both in an IF ELSE statement based on the control panel switch, and everything enclosed in a WHILE TRUE loop.This approach is not satisfactory since control does not transfer right away between the two modes when I switch from one to the other, but rather happens after while (there are a lot of things happening in each mode).  
I am not experienced in this kind of design and I would like to know if there are some sort of thumb rules for this(as I imagine most cells working auto and manual mode)…e.g should I run each mode in a trap routine instead of a regular procedure?

Thanks  
Alex

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [June 12, 2018, 11:54am UTC](https://tech-community.robotics.abb.com/t/auto-man-mode-best-practices/8302/2 "2018-06-12T11:54:28Z")

</div>

Can you post some of your code?

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [June 12, 2018, 1:23pm UTC](https://tech-community.robotics.abb.com/t/auto-man-mode-best-practices/8302/3 "2018-06-12T13:23:50Z")

</div>

Are you okay with losing your program pointer when someone switches modes or does it need to be retained?
