RobotStudio event

AUTO / MAN mode best practices

AlexRad Cluj-Napoca, Romania

  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?