<root>
<document scada='0' schema='102' license='1,Lord Grezington,6BDBE3' title='' description='' fcversion='524800' target='PIC.16F.16F1508' >
	<config data='!0,39a4!10,3dff%0,4%3,0%5,1%6,0%7,1%9,0%b,1%10,3%19,0%1a,1%1c,1%1d,1' clkspd='16000000' simspd='2' usewdt='0' constif='0' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug >
		<watch expr='Analogue_Speed' />
		<watch expr='AnalogueAVG' />
	</debug>
	<traces />
	<ghost >
		<FK2 >
			<data name='FK2D0' port='4294967295' pin='4294967295' />
			<data name='FK2D1' port='4294967295' pin='4294967295' />
			<data name='FK2D2' port='4294967295' pin='4294967295' />
			<data name='FK2D3' port='4294967295' pin='4294967295' />
			<data name='FK2D4' port='4294967295' pin='4294967295' />
			<data name='FK2D5' port='4294967295' pin='4294967295' />
			<data name='FK2D6' port='4294967295' pin='4294967295' />
			<data name='FK2D7' port='4294967295' pin='4294967295' />
			<data name='FK2D8' port='4294967295' pin='4294967295' />
			<data name='FK2D9' port='4294967295' pin='4294967295' />
			<data name='FK2D10' port='4294967295' pin='4294967295' />
			<data name='FK2D11' port='4294967295' pin='4294967295' />
			<data name='FK2D12' port='4294967295' pin='4294967295' />
			<data name='FK2D13' port='4294967295' pin='4294967295' />
			<data name='FK2D14' port='4294967295' pin='4294967295' />
			<data name='FK2D15' port='4294967295' pin='4294967295' />
			<data name='FK2A0' port='4294967295' pin='4294967295' />
			<data name='FK2A1' port='4294967295' pin='4294967295' />
			<data name='FK2A2' port='4294967295' pin='4294967295' />
			<data name='FK2A3' port='4294967295' pin='4294967295' />
			<data name='FK2A4' port='4294967295' pin='4294967295' />
			<data name='FK2A5' port='4294967295' pin='4294967295' />
		</FK2>
		<ICD >
			<data name='AnalogPrescaleValue' value='19' />
			<data name='DigitalSampleRate' value='100000' />
			<data name='BreakpointCount' value='8' />
			<data name='CallStackDepthCount' value='8' />
			<data name='ClockPort' value='0' />
			<data name='ClockPin' value='1' />
			<data name='DataPort' value='0' />
			<data name='DataPin' value='0' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='11' />
			<data name='CalculatedCommsDelay' value='11' />
			<data name='AnalogEB2PrescaleValue' value='2' />
			<data name='DigitalEB2SampleRate' value='100000' />
		</ICD>
		<pins >
			<digital A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
			<analog A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
		</pins>
	</ghost>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='51de3630-f902-41e6-8858-f65b8474ebf0' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='0' scadaCompatible='0' embeddedCompatible='1' iconpath='' />
		<component class_type='root' codename='panel' x='0' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='CRC' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='D_Byte_3' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='D_Byte_2' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='D_Byte_1' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='D_Byte_0' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Address' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Header' type='u8' description='' isconst='0' isinit='1' usrinit='160' setinit='0xA0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Speed' type='u32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='mSTEP' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='false' type='b1' description='' isconst='1' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Speed_VAR' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Data' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='AnalogueAVG' type='u32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='inc' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Enable' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Register' type='u8' description='' isconst='0' isinit='1' usrinit='7' setinit='0x07' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Analogue_Speed' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Direction_Flag' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Current_2' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Current_1' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Direction' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='SPD_RNG' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='AnlPulseSel' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='true' type='b1' description='' isconst='1' isinit='1' usrinit='1' setinit='1' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='Read_Register' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='Header' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = Header' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='Address' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = Address' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='Register' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = Register' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='CRC' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='CRC = 0' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='RampUp' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Inc = Speed / 344' />
							<exp exp='Speed = 0' />
							<exp exp='Register = 0xA2' />
						</command>
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='2' exp='344' >
							<flowline >
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='Speed = Speed + inc' />
									<exp exp='D_Byte_3 = Speed &gt;&gt; 24' />
									<exp exp='D_Byte_2 = Speed &gt;&gt; 16' />
									<exp exp='D_Byte_1 = Speed &gt;&gt; 8' />
									<exp exp='D_Byte_0 = Speed' />
								</command>
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
								<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='300' type='0' />
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Write_Register' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='Header' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = Header' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='Address' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = Address' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='Register' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = Register' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='D_Byte_3' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = D_Byte_3' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='D_Byte_2' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = D_Byte_2' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='D_Byte_1' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = D_Byte_1' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='D_Byte_0' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Data = D_Byte_0' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='CRC_Loop' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='SendChar' >
							<argument exp='CRC' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='CRC = 0' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='RampDown' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Inc = Speed / 344' />
							<exp exp='Register = 0xA2' />
						</command>
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='1' exp='Speed &lt;= (2 * Inc)' >
							<flowline >
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='Speed = Speed - inc' />
									<exp exp='D_Byte_3 = Speed &gt;&gt; 24' />
									<exp exp='D_Byte_2 = Speed &gt;&gt; 16' />
									<exp exp='D_Byte_1 = Speed &gt;&gt; 8' />
									<exp exp='D_Byte_0 = Speed' />
								</command>
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
								<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='300' type='0' />
							</flowline>
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='D_Byte_3 = 0' />
							<exp exp='D_Byte_2 = 0' />
							<exp exp='D_Byte_1 = 0' />
							<exp exp='D_Byte_0 = 0' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Index' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Start_Up' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='Initialise' />
						<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='100' type='1' />
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Register = 0xEC' />
							<exp exp='D_Byte_3 = 0x05' />
							<exp exp='D_Byte_2 = 0x00' />
							<exp exp='D_Byte_1 = 0x00' />
							<exp exp='D_Byte_0 = 0x50' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
						<command class_type='output' title='Pulse_CW' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048578' mask='128' exp='0' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Direction_Button' macro='ReadState' >
							<return exp='Direction' />
						</command>
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Direction' swap='0' >
							<flowline >
								<command class_type='calculation' title='Counter_Clockwise' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='Register = 0x80' />
									<exp exp='D_Byte_3 = 0x00' />
									<exp exp='D_Byte_2 = 0x00' />
									<exp exp='D_Byte_1 = 0x00' />
									<exp exp='D_Byte_0 = 0xC4' />
									<exp exp='Direction_Flag = 1' />
								</command>
							</flowline>
							<flowline >
								<command class_type='calculation' title='Clockwise' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='Register = 0x80' />
									<exp exp='D_Byte_3 = 0x00' />
									<exp exp='D_Byte_2 = 0x00' />
									<exp exp='D_Byte_1 = 0x00' />
									<exp exp='D_Byte_0 = 0xCC' />
									<exp exp='Direction_Flag = 0' />
								</command>
							</flowline>
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
						<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048576' mask='4' exp='mSTEP' />
						<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048578' mask='4' exp='SPD_RNG' />
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='SPD_RNG' swap='0' >
							<flowline >
								<command class_type='decision' title='800RPM' cmdcolor='12615680' cmdcolor_sec='15376912' exp='mSTEP' swap='0' >
									<flowline >
										<command class_type='calculation' title='256' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Speed_VAR = 1024' />
										</command>
									</flowline>
									<flowline >
										<command class_type='calculation' title='16' textarea='82,3,82,3' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Speed_VAR = 32' />
										</command>
									</flowline>
								</command>
							</flowline>
							<flowline >
								<command class_type='decision' title='150RPM' cmdcolor='12615680' cmdcolor_sec='15376912' exp='mSTEP' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Speed_VAR = 201' />
										</command>
									</flowline>
									<flowline >
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Speed_VAR = 6' />
										</command>
									</flowline>
								</command>
							</flowline>
						</command>
						<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048578' mask='2' exp='Current_1' />
						<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048578' mask='1' exp='Current_2' />
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Current_1' swap='1' >
							<flowline >
								<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Current_2' swap='1' >
									<flowline >
										<command class_type='calculation' title='1.3A' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Register = 0x90' />
											<exp exp='D_Byte_3 = 0x00' />
											<exp exp='D_Byte_2 = 0x00' />
											<exp exp='D_Byte_1 = 0x1E' />
											<exp exp='D_Byte_0 = 0x00' />
										</command>
									</flowline>
									<flowline >
										<command class_type='calculation' title='1A' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Register = 0x90' />
											<exp exp='D_Byte_3 = 0x00' />
											<exp exp='D_Byte_2 = 0x00' />
											<exp exp='D_Byte_1 = 0x17' />
											<exp exp='D_Byte_0 = 0x00' />
										</command>
									</flowline>
								</command>
							</flowline>
							<flowline >
								<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Current_2' swap='1' >
									<flowline >
										<command class_type='calculation' title='0.66A' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Register = 0x90' />
											<exp exp='D_Byte_3 = 0x00' />
											<exp exp='D_Byte_2 = 0x00' />
											<exp exp='D_Byte_1 = 0x0F' />
											<exp exp='D_Byte_0 = 0x00' />
										</command>
									</flowline>
									<flowline >
										<command class_type='calculation' title='0.33A' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Register = 0x90' />
											<exp exp='D_Byte_3 = 0x00' />
											<exp exp='D_Byte_2 = 0x00' />
											<exp exp='D_Byte_1 = 0x06' />
											<exp exp='D_Byte_0 = 0x00' />
										</command>
									</flowline>
								</command>
							</flowline>
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
						<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='100' type='1' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Enable_button' macro='ReadState' >
							<return exp='Enable' />
						</command>
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Enable' swap='0' >
							<flowline >
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='RampDown' />
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Enable_button' macro='WaitUntilHigh' />
							</flowline>
							<flowline />
						</command>
						<command class_type='decision' title='Step res setting' cmdcolor='12615680' cmdcolor_sec='15376912' exp='mSTEP' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='Register = 0xEC' />
									<exp exp='D_Byte_3 = 0x00' />
									<exp exp='D_Byte_2 = 0x00' />
									<exp exp='D_Byte_1 = 0x00' />
									<exp exp='D_Byte_0 = 0x53' />
								</command>
							</flowline>
							<flowline >
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='Register = 0xEC' />
									<exp exp='D_Byte_3 = 0x04' />
									<exp exp='D_Byte_2 = 0x00' />
									<exp exp='D_Byte_1 = 0x00' />
									<exp exp='D_Byte_0 = 0x53' />
								</command>
							</flowline>
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
					</flowline>
				</macro>
				<macro >
					<flowline name='CRC_Loop' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='comment' title='' comment='Decision:  (CRC &gt;&gt; 7) ^ (.Data &amp; 0x01)
Yes: Calculation: CRC = (CRC &lt;&lt; 1) ^ 0x07
No: Calculation: CRC = (CRC &lt;&lt; 1)

Calculation: .Data = .Data &gt;&gt; 1' textarea='12,0,12,0' cmdcolor='10944511' cmdcolor_sec='11465458' />
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='2' exp='8' >
							<flowline >
								<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='(CRC &gt;&gt; 7) ^ (Data &amp; 0x01)' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='CRC = (CRC &lt;&lt; 1) ^ 0x07' />
										</command>
									</flowline>
									<flowline >
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='CRC = (CRC &lt;&lt; 1)' />
										</command>
									</flowline>
								</command>
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='Data = Data &gt;&gt; 1' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='C Code' ccode='/*
  Enter C code below this comment
*/
OSCCON = 0x7A;' cmdcolor='7687168' cmdcolor_sec='8152576' language='C' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='RS232' macro='Initialise' />
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Header = 0x05' />
							<exp exp='Address = 0x00' />
							<exp exp='Speed_VAR = 954' />
							<exp exp='' />
						</command>
						<command class_type='label' title='Connection Point' cmdcolor='12615680' cmdcolor_sec='15376912' labelid='0' labelname='A' />
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Start_Up' />
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='AnalogueAVG = 0' />
						</command>
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='2' exp='100' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Analogue_Input' macro='GetInt' >
									<return exp='Analogue_Speed' />
								</command>
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='AnalogueAVG = AnalogueAVG + Analogue_Speed' />
								</command>
								<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='10' type='0' />
							</flowline>
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='AnalogueAVG = AnalogueAVG / 100' />
							<exp exp='Analogue_Speed = AnalogueAVG' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Speed = Analogue_Speed * Speed_VAR' />
						</command>
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Speed_VAR &gt; 0' swap='0' >
							<flowline >
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='RampUp' />
							</flowline>
							<flowline />
						</command>
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='1' >
							<flowline >
								<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048576' mask='32' exp='AnlPulseSel' />
								<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='AnlPulseSel' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='AnalogueAVG = 0' />
										</command>
										<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='2' exp='100' >
											<flowline >
												<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Analogue_Input' macro='GetInt' >
													<return exp='Analogue_Speed' />
												</command>
												<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
													<exp exp='AnalogueAVG = AnalogueAVG + Analogue_Speed' />
												</command>
												<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='10' type='0' />
											</flowline>
										</command>
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='AnalogueAVG = AnalogueAVG / 100' />
											<exp exp='Analogue_Speed = AnalogueAVG' />
										</command>
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Speed = Analogue_Speed * Speed_VAR' />
										</command>
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Register = 0xA2' />
											<exp exp='D_Byte_3 = Speed &gt;&gt; 24' />
											<exp exp='D_Byte_2 = Speed &gt;&gt; 16' />
											<exp exp='D_Byte_1 = Speed &gt;&gt; 8' />
											<exp exp='D_Byte_0 = Speed' />
										</command>
										<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
									</flowline>
									<flowline />
								</command>
								<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='50' type='1' />
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Enable_button' macro='ReadState' >
									<return exp='Enable' />
								</command>
								<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Enable' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Register = 0xEC' />
											<exp exp='D_Byte_3 = 0x00' />
											<exp exp='D_Byte_2 = 0x00' />
											<exp exp='D_Byte_1 = 0x00' />
											<exp exp='D_Byte_0 = 0x50' />
										</command>
										<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
										<command class_type='goto' title='Goto Connection Point' cmdcolor='12615680' cmdcolor_sec='15376912' labelid='0' labelname='' />
									</flowline>
									<flowline />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Direction_Button' macro='ReadState' >
									<return exp='Direction' />
								</command>
								<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Direction' swap='0' >
									<flowline >
										<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Direction_Flag' swap='0' >
											<flowline />
											<flowline >
												<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
													<exp exp='Register = 0xEC' />
													<exp exp='D_Byte_3 = 0x00' />
													<exp exp='D_Byte_2 = 0x00' />
													<exp exp='D_Byte_1 = 0x00' />
													<exp exp='D_Byte_0 = 0x50' />
												</command>
												<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
												<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
													<exp exp='Direction_Flag = 1' />
												</command>
												<command class_type='goto' title='Goto Connection Point' cmdcolor='12615680' cmdcolor_sec='15376912' labelid='0' labelname='' />
											</flowline>
										</command>
									</flowline>
									<flowline >
										<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Direction_Flag' swap='0' >
											<flowline >
												<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
													<exp exp='Register = 0xEC' />
													<exp exp='D_Byte_3 = 0x00' />
													<exp exp='D_Byte_2 = 0x00' />
													<exp exp='D_Byte_1 = 0x00' />
													<exp exp='D_Byte_0 = 0x50' />
												</command>
												<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Write_Register' />
												<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
													<exp exp='Direction_Flag = 0' />
												</command>
												<command class_type='goto' title='Goto Connection Point' cmdcolor='12615680' cmdcolor_sec='15376912' labelid='0' labelname='' />
											</flowline>
											<flowline />
										</command>
									</flowline>
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='c73616d1-7ad0-45d9-aada-69ccfa4c5efc' vmin='0' vmaj='2' codename='RS232' x='40' y='0' z='0.755' xsz='60' ysz='26' zsz='1.51' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='cal_uart::CHANNEL' data='001' />
					<value target='cal_uart::BAUD_LIST' data='004' />
					<value target='cal_uart::BAUD' data='9600' />
					<value target='cal_uart::DBITS' data='008' />
					<value target='cal_uart::RETURN' data='000' />
					<value target='cal_uart::ECHO' data='000' />
					<value target='cal_uart::UseTX' data='1' />
					<value target='cal_uart::TX' data='$PORTB.7' />
					<value target='cal_uart::OutputPins' data='007' />
					<value target='cal_uart::TXAlt' data='0' />
					<value target='cal_uart::UseRX' data='1' />
					<value target='cal_uart::RX' data='$PORTB.5' />
					<value target='cal_uart::InputPins' data='013' />
					<value target='cal_uart::RXAlt' data='0' />
					<value target='cal_uart::FLOWEN' data='000' />
					<value target='cal_uart::RTS' data='$PORTB.2' />
					<value target='cal_uart::CTS' data='$PORTB.1' />
					<value target='label' data='RS232' />
					<value target='cal_uart::ScopeTraces' data='0' />
					<value target='cal_uart::ConsoleData' data='0' />
					<value target='cal_uart::ConsoleColumns' data='64' />
					<value target='cal_uart::DataSource' data='000' />
					<value target='cal_uart::com_port' data='000' />
					<value target='cal_uart::Injector' data='000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='8462ac99-ca8f-429b-953a-36dbe58ada72' vmin='4' vmaj='1' codename='Analogue_Input' x='0' y='0' z='3.66' xsz='11.8794' ysz='11.8794' zsz='16' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='1' poslock='1' >
				<resources />
				<properties />
				<values >
					<value target='angle_start' data='225.000000' />
					<value target='angle_sweep' data='270.000000' />
					<value target='color' data='16777215' />
					<value target='ScopeTraces' data='0' />
					<value target='channel' data='7' />
					<value target='vrefvol' data='500' />
					<value target='vrefop' data='000' />
					<value target='convspd' data='003' />
					<value target='actime' data='40' />
					<value target='bits' data='10' />
					<value target='bitmul' data='0.004883' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='5c1da48f-ce54-4622-bdd9-fc812e373696' vmin='1' vmaj='1' codename='Enable_button' x='-96' y='16' z='-6.175' xsz='0.851064' ysz='0.851064' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pin' data='$PORTC.5' />
					<value target='polarity' data='001' />
					<value target='debounce' data='3' />
					<value target='operation' data='001' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='5c1da48f-ce54-4622-bdd9-fc812e373696' vmin='1' vmaj='1' codename='Direction_Button' x='-79.3798' y='16' z='-6.175' xsz='0.851064' ysz='0.851064' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pin' data='$PORTC.4' />
					<value target='polarity' data='001' />
					<value target='debounce' data='3' />
					<value target='operation' data='001' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<scadaresourcelookup />
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' >
		<background rgb='9737364' img='' style='0' />
		<camera xe='18.8076' ye='1.73891' ze='412.59' xt='18.8076' yt='1.73891' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='0' lighting='2' brightness='0' perspective='1' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='25' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey0 xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey1 xe='-3.67394e-14' ye='0' ze='-300' xt='0' yt='0' zt='0' xquat='0' yquat='1' zquat='0' wquat='6.12323e-17' />
		<camerakey2 xe='0' ye='-300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.707107' yquat='0' zquat='0' wquat='0.707107' />
		<camerakey3 xe='-3.67394e-14' ye='300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-4.32978e-17' yquat='0.707107' zquat='0.707107' wquat='4.32978e-17' />
		<camerakey4 xe='-300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='0.5' zquat='0.5' wquat='0.5' />
		<camerakey5 xe='300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='-0.5' zquat='-0.5' wquat='0.5' />
		<camerakey6 xe='-173.205' ye='-173.205' ze='173.205' xt='0' yt='0' zt='0' xquat='-0.424708' yquat='0.17592' zquat='0.339851' wquat='0.820473' />
	</panel3d>
	<layout >
		<view type='0' name='Start_Up' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAiAMAAPIBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Write_Register' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAiAMAAPIBAAA' zoom='75' scrollx='0' scrolly='1163' flags='0' />
		<view type='0' name='Index' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAiAMAAPIBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAiAMAAPIBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Read_Register' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAiAMAAPIBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='CRC_Loop' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAiAMAAPIBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='RampDown' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAiAMAAPIBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='RampUp' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAiAMAAPIBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
