(*@PROPERTIES_EX@
TYPE: POU
LOCALE: 0
IEC_LANGUAGE: ST
PLC_TYPE: independent
PROC_TYPE: independent
*)
(*@KEY@:DESCRIPTION*)

(*@KEY@:END_DESCRIPTION*)
FUNCTION_BLOCK ROBOT1 

(*Group:ROBOTV*)


VAR_EXTERNAL
	COUNTER_1 :	INT;
END_VAR


VAR_INPUT
	ROBOT_RANGE_POS_1 :	INT {CSV} ;
	ROBOT_RANGE_NEG_1 :	INT {CSV} ;
	ADD_ARM :	INT;
END_VAR


VAR_OUTPUT
	ROBOT_X :	INT {CSV} ;
	ROBOT_Y :	INT {CSV} ;
	ROBOT_Z :	INT {CSV} ;
END_VAR


VAR
	MODUS :	INT := 1;
END_VAR


(*@KEY@: WORKSHEET
NAME: ROBOT1
IEC_LANGUAGE: ST
*)
(*function_block: ROBOT1, ST
  example for KW-Software compatibility
  version: 1.0, 23.02.2009, DEVELOPER: KW-Software *)

CASE MODUS OF
1: ROBOT_X:= ROBOT_X + 200;
   ROBOT_Z := ROBOT_Z + ADD_ARM ;
   MODUS:=1;
   IF ROBOT_X >= ROBOT_RANGE_POS_1 THEN
      MODUS:=2;
   END_IF;
2: ROBOT_X:= ROBOT_X - 200; 
   ROBOT_Z := ROBOT_Z - ADD_ARM ;
   MODUS:=2;
   IF ROBOT_X <= ROBOT_RANGE_NEG_1 THEN
      MODUS:=1;
   END_IF;
END_CASE;   
ROBOT_Y:= ROBOT_X; 
COUNTER_1 := COUNTER_1 + 1;
IF COUNTER_1 > 1000 THEN
   COUNTER_1 := 0;
END_IF;


(*end of function_block*)
(*@KEY@: END_WORKSHEET *)
END_FUNCTION_BLOCK
