<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FBExchangeFile>
	<fileHeader company="Schneider Automation" product="Unity Pro XL V7.0 - 120823C" dateTime="date_and_time#2013-5-7-16:50:55" content="Function Block source file" DTDVersion="41"></fileHeader>
	<contentHeader name="Project" version="0.0.49" dateTime="date_and_time#2013-5-7-17:49:4"></contentHeader>
	<FBSource nameOfFBType="Drum_Sequencer" version="0.43" dateTime="dt#2013-05-07-16:48:39">
		<attribute name="TypeProtectionLevel" value="2#0000_0000"></attribute>
		<attribute name="TypeCodeCheckSumString" value="C593"></attribute>
		<attribute name="TypeSignatureCheckSumString" value="CCFF"></attribute>
		<inputParameters>
			<variables name="Reset" typeName="EBOOL">
				<comment>Return to step 0" input, at state 1 initializes the drum at step 0. </comment>
				<attribute name="PositionPin" value="1"></attribute>
			</variables>
			<variables name="Input" typeName="EBOOL">
				<comment>on rising edge causes the drum to advance by one step and the updating of the order bits.</comment>
				<attribute name="PositionPin" value="2"></attribute>
			</variables>
			<variables name="Steps" typeName="INT">
				<comment>Number of steps: possible values from 1 to 16 (default is 16). </comment>
				<attribute name="PositionPin" value="3"></attribute>
				<variableInit value="16"></variableInit>
			</variables>
			<variables name="Steps_Value" typeName="ARRAY[1..16] OF INT">
				<attribute name="PositionPin" value="5"></attribute>
				<instanceElementDesc name="[1]">
					<comment>Value for Step 1</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[2]">
					<comment>Value for Step 2</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[3]">
					<comment>Value for Step 3</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[4]">
					<comment>Value for Step 4</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[5]">
					<comment>Value for Step 5</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[6]">
					<comment>Value for Step 6</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[7]">
					<comment>Value for Step 7</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[8]">
					<comment>Value for Step 8</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[9]">
					<comment>Value for Step 9</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[10]">
					<comment>Value for Step 10</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[11]">
					<comment>Value for Step 11</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[12]">
					<comment>Value for Step 12</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[13]">
					<comment>Value for Step 13</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[14]">
					<comment>Value for Step 14</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[15]">
					<comment>Value for Step 15</comment>
				</instanceElementDesc>
				<instanceElementDesc name="[16]">
					<comment>Value for Step 16</comment>
				</instanceElementDesc>
			</variables>
		</inputParameters>
		<outputParameters>
			<variables name="Full" typeName="BOOL">
				<comment>Drum Full</comment>
				<attribute name="PositionPin" value="1"></attribute>
			</variables>
			<variables name="Output" typeName="INT">
				<comment>Drum Output</comment>
				<attribute name="PositionPin" value="2"></attribute>
			</variables>
			<variables name="Current_Step" typeName="INT">
				<comment>Between 1 and 16  this is the number of the current step.</comment>
				<attribute name="PositionPin" value="3"></attribute>
			</variables>
			<variables name="Step_Time" typeName="TIME">
				<comment>duration of current step</comment>
				<attribute name="PositionPin" value="4"></attribute>
			</variables>
		</outputParameters>
		<privateLocalVariables>
			<variables name="count" typeName="INT"></variables>
			<variables name="TON_0" typeName="TON"></variables>
			<variables name="timereset" typeName="BOOL"></variables>
			<variables name="Q_out" typeName="BOOL"></variables>
			<variables name="enab" typeName="BOOL">
				<variableInit value="1"></variableInit>
			</variables>
		</privateLocalVariables>
		<FBProgram name="code">
			<STSource>if (count&gt;Steps)then count:=1;
end_if;
if RE(Input)
then 
count:=count+1;
end_if;

if RE(input) then
timereset:=1;
else
timereset:=0;
end_if;

Output:=Steps_Value[count];
Current_Step:=count;

if RE(Reset) then count:=1;
end_if;


TON_0(IN:= not timereset, PT:=T#9999s,Q=&gt;Q_out, ET=&gt;step_time);

if count=Steps then

Full:=1;
else
full:=0;
end_if;
</STSource>
		</FBProgram>
	</FBSource>
</FBExchangeFile>
