RobotStudio event

Trap Routines

Hello everyone,

I have some questions for you. I want to learn somethng about trap routines. For exaple Why I must use trap routiens? or How can I use that? I need basic samples about this. I found a module aboot Trap routines. But I didnt understand well. I hope you cam help me. Thanks for all 


MODULE Warning
  VAR intnum nTimeInt_1;
  VAR intnum nTimeInt_2;
  PERS bool sim_test:=FALSE;
  PERS bool OpStart:=TRUE;

  PROC main()
    !===============================================================
    !TIME TRAP 1 CONNECTION
    !===============================================================
    IDelete nTimeInt_1;
    CONNECT nTimeInt_1 WITH TimeTrap1;
    ITimer 1,nTimeInt_1;
    !===============================================================
    !TIME TRAP 2 CONNECTION
    !===============================================================
    IDelete nTimeInt_2;
    CONNECT nTimeInt_2 WITH TimeTrap2;
    ITimer 0.5,nTimeInt_2;
    WHILE TRUE DO
      CheckErrorStatus;
      SystemStatus;
      IF OpStart=FALSE THEN
        IF DOutput(bFlash_1)=1 THEN
          Set doStReadyLamp;
        ELSE
          Reset doStReadyLamp;
        ENDIF
      ELSE
        Set doStReadyLamp;
      ENDIF
      WaitTime 0.3;
    ENDWHILE
  ENDPROC
Tagged:

Comments

  • The manual RAPID Overview that is available in RobotStudio provides a good starting point.

    TRAP routines are convenient when you want to interrupt the program flow to act on some external event.

    /Henrik

     

    Henrik Berlin
    ABB
  • Thanks Henrik for your informations