%%%
  VERSION:1
  LANGUAGE:ENGLISH
%%%

MODULE CAL840
  !COPYRIGHT 1998 ABB ROBOTICS PRODUCTS AB
  !1998-10-13 SEROP/PU/SLT

  !#########################################################################
  ! Revision notes:
  ! New Program   1998-10-13/SLT
  ! Comments added proc haupt, Principale     1998-10-23/SLT

  !#########################################################################

  VAR num answer;
  VAR bool flag;
  VAR string irbtype;
  VAR jointtarget before_norm_pos;
  VAR jointtarget stand_norm_pos;

  PROC Haupt()
    !Routine used when German is booted
    main;
  ENDPROC

  PROC Principale()
    !Routine used when Italian is booted
    main;
  ENDPROC

  PROC main()
    TPErase;
    TPWrite "CALIBRATION POSITION PROGRAM";
    TPReadFK answer,"Select type of IRB840...","IRB 840","","","","EXIT";
    TEST answer
    CASE 1:
      irbtype:="IRB840/";
      before_norm_pos:=[[496,-496,254,4,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
      stand_norm_pos:=[[500,-500,250,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    CASE 5:
      EXIT;
    ENDTEST
    pos_routine;
  ENDPROC

  PROC pos_routine()
    flag:=TRUE;
    WHILE flag DO
      TPErase;
      TPWrite "Calibrationprogram for ";
      TPWrite irbtype;
      TPReadFK answer,"Move to Calibration position?","OK","","","","EXIT";
      TEST answer
      CASE 1:
        home_stand_norm;
      CASE 5:
        flag:=FALSE;
      ENDTEST
    ENDWHILE
  ENDPROC

  PROC home_stand_norm()
    TPErase;
    TPWrite "Moving to normal position (sync.pos 0)..";
    MoveAbsJ before_norm_pos,v200,fine,tool0;
    MoveAbsJ stand_norm_pos,v200,fine,tool0;
  ENDPROC
ENDMODULE

