<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RSLogix5000Content SchemaRevision="1.0" SoftwareRevision="20.01" TargetName="T2HC" TargetType="AddOnInstructionDefinition" TargetRevision="1.1 " TargetLastEdited="2015-05-04T20:56:00.012Z" ContainsContext="true" Owner="Exlar, Exlar" ExportDate="Mon May 04 16:01:35 2015" ExportOptions="References DecoratedData Context Dependencies ForceProtectedEncoding AllProjDocTrans">
<Controller Use="Context" Name="Exlar_AOI_Sample_Project_v1_0">
<DataTypes Use="Context">
</DataTypes>
<AddOnInstructionDefinitions Use="Context">
<AddOnInstructionDefinition Use="Target" Name="T2HC" Revision="1.1" Vendor="Exlar Corporation" ExecutePrescan="false" ExecutePostscan="false" ExecuteEnableInFalse="false" CreatedDate="2014-04-17T17:09:23.484Z" CreatedBy="INT\jalvarez" EditedDate="2015-05-04T20:56:00.012Z" EditedBy="INT\SU_jalvarez"
 SoftwareRevision="v20.01">
<AdditionalHelpText>
<![CDATA[Use the Tritex 2 HC(T2HC) instruction to control drive Host Control Option

Configured for Exlar EIP AOI. 07/01/2014

----------------------------------------------------------------------------------------------------------------------------
Parameters Bit Definition
----------------------------------------------------------------------------------------------------------------------------

CommandMode:   (Input) Control Host Mode
------------------------------------------------------------------
   0 = Disable Host Control
   5 = Position
   6 = Velocity
   7 = Current]]>
</AdditionalHelpText>
<Parameters>
<Parameter Name="EnableIn" TagType="Base" DataType="BOOL" Usage="Input" Radix="Decimal" Required="false" Visible="false" ExternalAccess="Read Only">
<Description>
<![CDATA[Enable Input - System Defined Parameter]]>
</Description>
</Parameter>
<Parameter Name="EnableOut" TagType="Base" DataType="BOOL" Usage="Output" Radix="Decimal" Required="false" Visible="false" ExternalAccess="Read Only">
<Description>
<![CDATA[Enable Output - System Defined Parameter]]>
</Description>
</Parameter>
<Parameter Name="ModuleInputs" TagType="Base" DataType="INT" Dimensions="101" Usage="InOut" Radix="Decimal" Required="true" Visible="true" Constant="false">
<Description>
<![CDATA[Module Input Array]]>
</Description>
</Parameter>
<Parameter Name="ModuleOutputs" TagType="Base" DataType="INT" Dimensions="101" Usage="InOut" Radix="Decimal" Required="true" Visible="true" Constant="false">
<Description>
<![CDATA[Module Output Array]]>
</Description>
</Parameter>
<Parameter Name="Units" TagType="Base" DataType="REAL" Dimensions="4" Usage="InOut" Radix="Float" Required="true" Visible="true" Constant="false">
<Description>
<![CDATA[Units]]>
</Description>
</Parameter>
<Parameter Name="CommandMode" TagType="Base" DataType="INT" Usage="Input" Radix="Decimal" Required="false" Visible="true" ExternalAccess="Read/Write">
<Description>
<![CDATA[Host Control]]>
</Description>
<DefaultData>00 00</DefaultData>
<DefaultData Format="Decorated">
<DataValue DataType="INT" Radix="Decimal" Value="0"/>
</DefaultData>
</Parameter>
<Parameter Name="Position" TagType="Base" DataType="REAL" Usage="Input" Radix="Float" Required="false" Visible="true" ExternalAccess="Read/Write">
<Description>
<![CDATA[Position]]>
</Description>
<DefaultData>00 00 00 00</DefaultData>
<DefaultData Format="Decorated">
<DataValue DataType="REAL" Radix="Float" Value="0.0"/>
</DefaultData>
</Parameter>
<Parameter Name="Velocity" TagType="Base" DataType="REAL" Usage="Input" Radix="Float" Required="false" Visible="true" ExternalAccess="Read/Write">
<Description>
<![CDATA[Velocity]]>
</Description>
<DefaultData>00 00 00 00</DefaultData>
<DefaultData Format="Decorated">
<DataValue DataType="REAL" Radix="Float" Value="0.0"/>
</DefaultData>
</Parameter>
<Parameter Name="Acceleration" TagType="Base" DataType="INT" Usage="Input" Radix="Decimal" Required="false" Visible="true" ExternalAccess="Read/Write">
<Description>
<![CDATA[Acceleration]]>
</Description>
<DefaultData>00 00</DefaultData>
<DefaultData Format="Decorated">
<DataValue DataType="INT" Radix="Decimal" Value="0"/>
</DefaultData>
</Parameter>
<Parameter Name="Current" TagType="Base" DataType="REAL" Usage="Input" Radix="Float" Required="false" Visible="true" ExternalAccess="Read/Write">
<Description>
<![CDATA[Current]]>
</Description>
<DefaultData>00 00 00 00</DefaultData>
<DefaultData Format="Decorated">
<DataValue DataType="REAL" Radix="Float" Value="0.0"/>
</DefaultData>
</Parameter>
<Parameter Name="DF" TagType="Base" DataType="BOOL" Usage="Output" Radix="Decimal" Required="false" Visible="true" ExternalAccess="Read Only">
<Description>
<![CDATA[A Drive Fault is active]]>
</Description>
<DefaultData>00</DefaultData>
<DefaultData Format="Decorated">
<DataValue DataType="BOOL" Radix="Decimal" Value="0"/>
</DefaultData>
</Parameter>
<Parameter Name="ER" TagType="Base" DataType="BOOL" Usage="Output" Radix="Decimal" Required="false" Visible="true" ExternalAccess="Read Only">
<Description>
<![CDATA[A Instruction error is Active]]>
</Description>
<DefaultData>00</DefaultData>
<DefaultData Format="Decorated">
<DataValue DataType="BOOL" Radix="Decimal" Value="0"/>
</DefaultData>
</Parameter>
</Parameters>
<LocalTags>
<LocalTag Name="dintResults" DataType="DINT" Radix="Decimal" ExternalAccess="None">
<DefaultData>00 00 00 00</DefaultData>
<DefaultData Format="Decorated">
<DataValue DataType="DINT" Radix="Decimal" Value="0"/>
</DefaultData>
</LocalTag>
</LocalTags>
<Routines>
<Routine Name="Logic" Type="ST">
<STContent>
<Line Number="0">
<![CDATA[(***********************************************)]]>
</Line>
<Line Number="1">
<![CDATA[(*   Exlar Tritex 2 Host Control               *)]]>
</Line>
<Line Number="2">
<![CDATA[(*                                             *)]]>
</Line>
<Line Number="3">
<![CDATA[(***********************************************)]]>
</Line>
<Line Number="4">
<![CDATA[]]>
</Line>
<Line Number="5">
<![CDATA[]]>
</Line>
<Line Number="6">
<![CDATA[(* Precondition  *)]]>
</Line>
<Line Number="7">
<![CDATA[	ER	:= 0;]]>
</Line>
<Line Number="8">
<![CDATA[]]>
</Line>
<Line Number="9">
<![CDATA[]]>
</Line>
<Line Number="10">
<![CDATA[(* Check valid Host Control *) ]]>
</Line>
<Line Number="11">
<![CDATA[	if CommandMode = 0 OR CommandMode = 5 ]]>
</Line>
<Line Number="12">
<![CDATA[		OR CommandMode = 6 OR CommandMode = 7 then]]>
</Line>
<Line Number="13">
<![CDATA[]]>
</Line>
<Line Number="14">
<![CDATA[		(* ID:4303, Control.Host.CommandMode:  ModuleOutputs[4]] *)]]>
</Line>
<Line Number="15">
<![CDATA[		ModuleOutputs[4]	:=	CommandMode;]]>
</Line>
<Line Number="16">
<![CDATA[	else]]>
</Line>
<Line Number="17">
<![CDATA[		ER	:= 1;]]>
</Line>
<Line Number="18">
<![CDATA[		ModuleOutputs[4] := 0;]]>
</Line>
<Line Number="19">
<![CDATA[	end_if;]]>
</Line>
<Line Number="20">
<![CDATA[]]>
</Line>
<Line Number="21">
<![CDATA[]]>
</Line>
<Line Number="22">
<![CDATA[(********** Outputs **********)]]>
</Line>
<Line Number="23">
<![CDATA[(* Drive Faults Active *)]]>
</Line>
<Line Number="24">
<![CDATA[	(* 104.03 Fault *)]]>
</Line>
<Line Number="25">
<![CDATA[	If ModuleInputs[1].03 then]]>
</Line>
<Line Number="26">
<![CDATA[ 		DF := 1;]]>
</Line>
<Line Number="27">
<![CDATA[	Else]]>
</Line>
<Line Number="28">
<![CDATA[		DF := 0;]]>
</Line>
<Line Number="29">
<![CDATA[	End_If;]]>
</Line>
<Line Number="30">
<![CDATA[]]>
</Line>
<Line Number="31">
<![CDATA[]]>
</Line>
<Line Number="32">
<![CDATA[(* Error Test *)	]]>
</Line>
<Line Number="33">
<![CDATA[	(* User Units Instruction error active ? *)]]>
</Line>
<Line Number="34">
<![CDATA[	IF Units[0] > 0 THEN]]>
</Line>
<Line Number="35">
<![CDATA[		ER	:= 1;]]>
</Line>
<Line Number="36">
<![CDATA[	end_if;]]>
</Line>
<Line Number="37">
<![CDATA[]]>
</Line>
<Line Number="38">
<![CDATA[	if NOT ER  then]]>
</Line>
<Line Number="39">
<![CDATA[]]>
</Line>
<Line Number="40">
<![CDATA[		(* Position *)]]>
</Line>
<Line Number="41">
<![CDATA[		(* ID:4304, Control.Host.Postion:  ModuleOutputs[6],ModuleOutputs[5] *)]]>
</Line>
<Line Number="42">
<![CDATA[		dintResults	:= (Position / Units[3]) * 65536;]]>
</Line>
<Line Number="43">
<![CDATA[		cps(dintResults, ModuleOutputs[5],2);	]]>
</Line>
<Line Number="44">
<![CDATA[]]>
</Line>
<Line Number="45">
<![CDATA[		(* Velocity in Seconds ? *)]]>
</Line>
<Line Number="46">
<![CDATA[		if Units[2] = 0 then]]>
</Line>
<Line Number="47">
<![CDATA[]]>
</Line>
<Line Number="48">
<![CDATA[			(* Velocity *)]]>
</Line>
<Line Number="49">
<![CDATA[			(* ID:4306, Control.Host.Velocity:  ModuleOutputs[8],ModuleOutputs[7] *)]]>
</Line>
<Line Number="50">
<![CDATA[			ModuleOutputs[8] := (Velocity / Units[3]* 255);]]>
</Line>
<Line Number="51">
<![CDATA[]]>
</Line>
<Line Number="52">
<![CDATA[			(* Acceleration *)]]>
</Line>
<Line Number="53">
<![CDATA[			(* ID:4308, Control.Host.Acceleration:  ModuleOutputs[10],ModuleOutputs[9] *)]]>
</Line>
<Line Number="54">
<![CDATA[			dintResults := ((Acceleration / Units[3]) * 16#100000)/60;]]>
</Line>
<Line Number="55">
<![CDATA[			cps(dintResults, ModuleOutputs[9],2);]]>
</Line>
<Line Number="56">
<![CDATA[		else]]>
</Line>
<Line Number="57">
<![CDATA[			(* Velocity in Minutes ? *)]]>
</Line>
<Line Number="58">
<![CDATA[			if Units[2] = 1 then]]>
</Line>
<Line Number="59">
<![CDATA[]]>
</Line>
<Line Number="60">
<![CDATA[			(* Velocity *)]]>
</Line>
<Line Number="61">
<![CDATA[			(* ID:4306, Control.Host.Velocity:  ModuleOutputs[8],ModuleOutputs[7] *)]]>
</Line>
<Line Number="62">
<![CDATA[			ModuleOutputs[8] := ((Velocity / Units[3])/60)*255;]]>
</Line>
<Line Number="63">
<![CDATA[]]>
</Line>
<Line Number="64">
<![CDATA[			(* Acceleration *)]]>
</Line>
<Line Number="65">
<![CDATA[			(* ID:4308, Control.Host.Acceleration:  ModuleOutputs[10],ModuleOutputs[9] *)]]>
</Line>
<Line Number="66">
<![CDATA[			dintResults := ((Acceleration / Units[3]) * 16#100000);]]>
</Line>
<Line Number="67">
<![CDATA[			cps(dintResults, ModuleOutputs[9],2);]]>
</Line>
<Line Number="68">
<![CDATA[]]>
</Line>
<Line Number="69">
<![CDATA[			end_if;]]>
</Line>
<Line Number="70">
<![CDATA[		end_if;]]>
</Line>
<Line Number="71">
<![CDATA[]]>
</Line>
<Line Number="72">
<![CDATA[		(* Set Velocity lower word to zero *)	]]>
</Line>
<Line Number="73">
<![CDATA[		(* ID: 4306, Control.Host.Velocity[Low]   : ModuleOutputs[7] *)]]>
</Line>
<Line Number="74">
<![CDATA[		 ModuleOutputs[7]  :=0;]]>
</Line>
<Line Number="75">
<![CDATA[]]>
</Line>
<Line Number="76">
<![CDATA[		(* Current Scale   *)]]>
</Line>
<Line Number="77">
<![CDATA[		(*       0: AMPs   *)]]>
</Line>
<Line Number="78">
<![CDATA[		(*       1: %      *)]]>
</Line>
<Line Number="79">
<![CDATA[		(* ID:4310, Control.Host.Current:  ModuleOutputs[11] *)]]>
</Line>
<Line Number="80">
<![CDATA[		if Units[1] = 0	then ]]>
</Line>
<Line Number="81">
<![CDATA[			ModuleOutputs[11] := Current / 0.0078125 ;	]]>
</Line>
<Line Number="82">
<![CDATA[		else]]>
</Line>
<Line Number="83">
<![CDATA[			(* Use for % ,ID:5108, Config.CurrentLimit:   ModuleInputs[13],  *)]]>
</Line>
<Line Number="84">
<![CDATA[			ModuleOutputs[11] := ModuleInputs[13] * (Current /100);]]>
</Line>
<Line Number="85">
<![CDATA[		end_if;]]>
</Line>
<Line Number="86">
<![CDATA[	end_if;]]>
</Line>
<Line Number="87">
<![CDATA[]]>
</Line>
<Line Number="88">
<![CDATA[]]>
</Line>
<Line Number="89">
<![CDATA[]]>
</Line>
</STContent>
</Routine>
</Routines>
</AddOnInstructionDefinition>
</AddOnInstructionDefinitions>
</Controller>
</RSLogix5000Content>
