PROGRAM P2P
VAR_EXTERNAL

END_VAR

VAR_GLOBAL

END_VAR

VAR
int1   :bool;
toncycle            :ton;
cycle               :bool;
NetVarSend_Slave	: NetVarSend;
en_word1 at%m6000.0 : dint;
b_en01   at%m6000.1 : bool;
b_en02   at%m6000.2 : bool;
b_en03   at%m6000.3 : bool;
b_en04   at%m6000.4 : bool;
b_en05   at%m6000.5 : bool;
b_en06   at%m6000.6 : bool;
b_en07   at%m6000.7 : bool;
b_en08   at%m6001.0 : bool;
b_en09   at%m6001.1 : bool;
b_en10   at%m6001.2 : bool;
b_en11   at%m6001.3 : bool;
b_en12   at%m6001.4 : bool;
b_en13   at%m6001.5 : bool;
b_en14   at%m6001.6 : bool;
b_en15   at%m6001.7 : bool;
b_en16   at%m6002.0 : bool;
b_en17   at%m6002.1 : bool;
b_en18   at%m6002.2 : bool;
b_en19   at%m6002.3 : bool;
b_en20   at%m6002.4 : bool;
b_en21   at%m6002.5 : bool;
b_en22   at%m6002.6 : bool;
b_en23   at%m6002.7 : bool;
b_en24   at%m6003.0 : bool;
b_en25   at%m6003.1 : bool;
b_en26   at%m6003.2 : bool;
b_en27   at%m6003.3 : bool;
b_en28   at%m6003.4 : bool;
b_en29   at%m6003.5 : bool;
b_en30   at%m6003.6 : bool;

en_word2 at%m6004.0 : Sint;
b_en31   at%m6004.1 : bool;
b_en32   at%m6004.2 : bool;

temp :bool;
en_enable1 :bool;
en_enable2 :bool;

END_VAR

(*Automatically declared*)
VAR_EXTERNAL
	RNIIES05H01_CO2S : REAL;
END_VAR
(** cycle:=not toncycle.q; **)
	(* assign - Stmt *)
	LD toncycle.q
	NOT
	ST cycle

(** toncycle(IN:=cycle,PT:=t#150ms); **)
	(* call - Stmt *)
	CAL toncycle (
		IN := cycle,
		PT := t#150ms
	)

(**  **)
(** if en_enable1=0 and temp=0 then  **)
	(* if - Cond *)
	LD en_enable1
	EQ 0
	AND ( temp
		EQ 0
	)
	JMPCN ODK_SKIP_000000000000001_000000000000001

		(* then - Stmts *)

(** 	en_enable1:=1;  **)
		(* assign - Stmt *)
		LD 1
		ST en_enable1

(** 	en_word1:=1; **)
		(* assign - Stmt *)
		LD 1
		ST en_word1

(** 	en_word2:=1; **)
		(* assign - Stmt *)
		LD 1
		ST en_word2

(** 	temp:=1;  **)
		(* assign - Stmt *)
		LD 1
		ST temp

		JMP ODK_END_IF_000000000000001

(** end_if; **)
	(* if - End *) 
	ODK_SKIP_000000000000001_000000000000001:
	ODK_END_IF_000000000000001:

(**  **)
(**  **)
(**  **)
(** if en_word1=2#10000000000000000000000000000000 then  **)
	(* if - Cond *)
	LD en_word1
	EQ 2#10000000000000000000000000000000
	JMPCN ODK_SKIP_000000000000002_000000000000001

		(* then - Stmts *)

(** 	en_enable1:=0 ; **)
		(* assign - Stmt *)
		LD 0
		ST en_enable1

(** 	en_enable2:=1 ; **)
		(* assign - Stmt *)
		LD 1
		ST en_enable2

(** 	en_word1:=0; **)
		(* assign - Stmt *)
		LD 0
		ST en_word1

(** 	en_word2:=1; **)
		(* assign - Stmt *)
		LD 1
		ST en_word2

		JMP ODK_END_IF_000000000000002

(** end_if; **)
	(* if - End *) 
	ODK_SKIP_000000000000002_000000000000001:
	ODK_END_IF_000000000000002:

(** if en_word2=2#10000000 then  **)
	(* if - Cond *)
	LD en_word2
	EQ 2#10000000
	JMPCN ODK_SKIP_000000000000003_000000000000001

		(* then - Stmts *)

(** 	en_enable1:=1 ; **)
		(* assign - Stmt *)
		LD 1
		ST en_enable1

(** 	en_enable2:=0 ; **)
		(* assign - Stmt *)
		LD 0
		ST en_enable2

(** 	en_word1:=1; **)
		(* assign - Stmt *)
		LD 1
		ST en_word1

(** 	en_word2:=0; **)
		(* assign - Stmt *)
		LD 0
		ST en_word2

		JMP ODK_END_IF_000000000000003

(** end_if; **)
	(* if - End *) 
	ODK_SKIP_000000000000003_000000000000001:
	ODK_END_IF_000000000000003:

(**  **)
(** if toncycle.q=1 then  **)
	(* if - Cond *)
	LD toncycle.q
	EQ 1
	JMPCN ODK_SKIP_000000000000004_000000000000001

		(* then - Stmts *)

(** 	if en_enable1=1 then **)
		(* if - Cond *)
		LD en_enable1
		EQ 1
		JMPCN ODK_SKIP_000000000000005_000000000000001

			(* then - Stmts *)

(** 		en_word1:=en_word1*2; **)
			(* assign - Stmt *)
			LD en_word1
			MUL 2
			ST en_word1

			JMP ODK_END_IF_000000000000005

(** 	end_if; **)
		(* if - End *) 
		ODK_SKIP_000000000000005_000000000000001:
		ODK_END_IF_000000000000005:

(** 	if en_enable2=1 then **)
		(* if - Cond *)
		LD en_enable2
		EQ 1
		JMPCN ODK_SKIP_000000000000006_000000000000001

			(* then - Stmts *)

(** 		en_word2:=en_word2*2; **)
			(* assign - Stmt *)
			LD en_word2
			MUL 2
			ST en_word2

			JMP ODK_END_IF_000000000000006

(** 	end_if; **)
		(* if - End *) 
		ODK_SKIP_000000000000006_000000000000001:
		ODK_END_IF_000000000000006:

		JMP ODK_END_IF_000000000000004

(** end_if;	 **)
	(* if - End *) 
	ODK_SKIP_000000000000004_000000000000001:
	ODK_END_IF_000000000000004:

(**  **)
(**  **)
(**  **)
(**    NetVarSend_Slave(EN := b_en01, IP1 := 192, IP2 := 168, IP3 := 50, IP4 := 22, ADDR_LOCAL := 5800, ADDR_REMOTE := 4000, NUM :=  4); **)
	(* call - Stmt *)
	CAL NetVarSend_Slave (
		EN := b_en01,
		IP1 := 192,
		IP2 := 168,
		IP3 := 50,
		IP4 := 22,
		ADDR_LOCAL := 5800,
		ADDR_REMOTE := 4000,
		NUM := 4
	)

(**  **)
(**  **)
(** RNIIES05H01_CO2S:=LIES05H01_CO2S    ; **)
	(* assign - Stmt *)
	LD LIES05H01_CO2S
	ST RNIIES05H01_CO2S


END_PROGRAM