Stop program when position is reached

  • Hello.

    I have a main.src program that calls another program AxisScan.src


    In main.src i have declared a global interrupt that should detect errors:

    Code
    GLOBAL INTERRUPT DECL 4 WHEN RuntimeError==TRUE DO OnError()
    INTERRUPT ON 4

    The RuntimeError variable is declared in main.dat

    Code
    GLOBAL BOOL RuntimeError=TRUE; 


    The OnError subprogram should stop movement, cancel programs and wait for signal from PLC before continuing execution of main.src.

    Code
    def OnError()
       BRAKE;
       wait for I_ResetRuntimeError;
       RuntimeError = false;
       O_RuntimeError = false;
       CONTINUE;
    end


    The AxisScan program is executed from a subprogram in main.src

    Code
    def ScanVertical()
       BAS(#BASE, DefaultBaseNo);
       BAS(#TOOL, SensorToolNo);
       AxisScan(V_S_Start, V_S_End);
    end


    The AxisScan program scans a part with a sensor mounted on the tool. The scanning process is stopped as soon as the robot gets a signal from the sensor.

    AxisScan program:

    StopScan looks like this and works. This cancels the DoScan subprogram and stops robot motion.

    Code
    def StopScan()
       brake F; Stop robot motion
       resume; Cancel all subprograms
    end


    The subprogram that executes the scanning movement looks like this

    Code
    def DoScan(target:IN)
       e6pos target;
       LIN target;
       RuntimeError = true; This should stop the AxisScan program
    end

    When RuntimeError is set to true i expect the robot to stop until a signal is detected from PLC and AxisScan to stop execution, but AxisScan continues execution and robot is never stopped.

    Can anyone help me on this?

    Edited 2 times, last by EiBru: Code blocks ().

  • MOM

    Approved the thread.
    • Helpful

    First, in StopScan(), make sure you actually want

    Code
    brake F; Stop robot motion

    instead of simple brake.


    The reason why interrupt 4 never gets activated- interrupts are triggered by rising edge and you already have

    Code
    GLOBAL BOOL RuntimeError=TRUE;

    that I suspect is not set to false anywhere outside the interrupt routine.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now