<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.10">
  <POU Name="PRG_ChannelHandler" Id="{c26edc63-cb02-4919-b2e3-ac8f67c34d02}" SpecialFunc="None">
    <Declaration><![CDATA[PROGRAM PRG_ChannelHandler
VAR
	nChan:				 	UINT;
	fbNCIChannel1: 			FB_NCIChannel;	
END_VAR
]]></Declaration>
    <Implementation>
      <ST><![CDATA[(* ==========================================================*)
(*   FB: FB_ChannelHandler		                             *)
(* ----------------------------------------------------------*)
(*   Desc:  										         *)
(*   Auth: TV                                                *)
(*   Date: 02.04.2013                                        *)
(*   Last: 02.04.2013                                        *)
(*   Rev.: 1.0                                               *)
(* ==========================================================*)

// Channel 1 is PTP Channel

// First NC I Channel, default Channel ID=2 
nChan:= 2;
IF NOT bAllCoupled THEN
PLCMachineMode[nChan].Start:=FALSE;
END_IF
fbNCIChannel1(
	nChan:= nChan,

	(* Operation Mode *)
	bModeStandby := 			PLCMachineMode[nChan].Standby,
	bModeAutomatic :=			PLCMachineMode[nChan].Automatic,
	bModeManual :=				PLCMachineMode[nChan].Manual,
	bModeMDI :=					PLCMachineMode[nChan].MDI,
	bModeReference :=			PLCMachineMode[nChan].Homing,

	(* Operation State *)
	bStateStart:= 				PLCMachineMode[nChan].Start,
	bStateStop:= 				PLCMachineMode[nChan].Stop,
	bStateReset:= 				PLCMachineMode[nChan].Reset,

	(* Special Functions *)
	bBackwardMotion:= 			PLCMachineMode[nChan].Backward,
	bPrgBlockIgnore:= 			PLCMachineMode[nChan].PrgBlockIgnore,
	bFeedHold:= 				PLCMachineMode[nChan].FeedHold,
	bSingleBlock:= 				PLCMachineMode[nChan].SingleBlock,
	bDoSingleBlock:= 			PLCMachineMode[nChan].DoSingleBlock,

	(* Strings *)
	sProgramName := 			PLCMachineMode[nChan].ProgramName,
	sMDIString :=				PLCMachineMode[nChan].MDIString );

]]></ST>
    </Implementation>
    <LineIds Name="PRG_ChannelHandler">
      <LineId Id="3" Count="13" />
      <LineId Id="49" Count="0" />
      <LineId Id="17" Count="0" />
      <LineId Id="50" Count="0" />
      <LineId Id="18" Count="25" />
      <LineId Id="2" Count="0" />
    </LineIds>
  </POU>
</TcPlcObject>