<root>
<document scada='0' schema='102' license='1,Dave Squibb,HXU85Z' title='' description='' fcversion='524802' target='PIC.16F.16F1938' >
	<config data='!0,9c2!10,1633%0,2%3,0%5,0%6,1%7,1%8,1%9,0%b,1%c,0%d,0%10,3%14,3%18,0%19,1%1a,1%1c,1%1d,0' clkspd='10000000' simspd='1' usewdt='0' constif='0' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug >
		<watch expr='StrData' />
		<watch expr='StrLength' />
		<watch expr='StrIndex' />
		<watch expr='VarIndex' />
		<watch expr='state' />
		<watch expr='NumericData' />
		<watch expr='Byte1' />
		<watch expr='Test' />
		<watch expr='ProductSelect' />
	</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='1' />
			<data name='ClockPin' value='6' />
			<data name='DataPort' value='1' />
			<data name='DataPin' value='7' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='17' />
			<data name='CalculatedCommsDelay' value='17' />
			<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='48cbb217-5fbf-44a6-a4ad-9e8da6711ebd' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='1' 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='NumericData' type='u16' description='' isconst='0' isinit='0' usrinit='0' setinit='' >
						<array size='20' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Low' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Byte4' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Count' type='u32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Test' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Byte3' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Byte2' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='StrIndex' type='u16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Byte1' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Byte0' type='u16' 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='TimerStop' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='ProductSelect' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='state' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='VarIndex' type='u16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='retval' type='u8' description='' isconst='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Limit' type='u32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='StrData' type='T8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='50' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='High' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TimerStart' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Start' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='FileLength' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='StrLength' type='u16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='FirstByte' type='u16' 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>
				<variable public='0' >
					<def class_type='variable' name='Time' type='u32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Flag' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='CCP1_Int' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='C Code' ccode='TMR1L = 0;
TMR1H = 0;' cmdcolor='7687168' cmdcolor_sec='8152576' language='C' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Direction' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048578' mask='16' exp='0' />
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048578' mask='32' exp='0' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='Initialise' />
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='1' >
							<flowline >
								<command class_type='comment' title='' comment='Hall Direction detection. CW short pulse, CCW long pulse.
Duration depends on motor speed. Firstly measure time for 1 revolution.
Set a flag. Then measure pulse length from hall 1 on to hall 2 on.
Compare this length with time or half a revolution (measured above).
Clear flag, go again. This runs continuously.
Hall switches mounted at approx 90 degrees apart on disc. 1 magnet.' textarea='12,0,12,0' cmdcolor='10944511' cmdcolor_sec='11465458' />
								<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048578' mask='4' exp='TimerStart' />
								<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='TimerStart = 0' swap='0' >
									<flowline >
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Timer2' macro='StartCounter' >
											<argument exp='1' />
										</command>
										<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='TimerStart = 0' >
											<flowline >
												<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048578' mask='4' exp='TimerStart' />
											</flowline>
										</command>
										<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='TimerStart = 1' >
											<flowline >
												<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048578' mask='4' exp='TimerStart' />
											</flowline>
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Timer2' macro='StopCounter' />
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Timer2' macro='GetCountMilliseconds' >
											<return exp='Limit' />
										</command>
										<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='SetInt' >
											<argument exp='0' />
											<argument exp='Limit' />
										</command>
										<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
											<return exp='Byte0' />
											<argument exp='0' />
										</command>
										<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
											<return exp='Byte1' />
											<argument exp='1' />
										</command>
										<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
											<return exp='Byte2' />
											<argument exp='2' />
										</command>
										<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
											<return exp='Byte3' />
											<argument exp='3' />
										</command>
										<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
											<return exp='Byte4' />
											<argument exp='4' />
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
											<argument exp='Byte4' />
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
											<argument exp='Byte3' />
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
											<argument exp='Byte2' />
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
											<argument exp='Byte1' />
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
											<argument exp='Byte0' />
										</command>
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Limit = Limit / 2' />
											<exp exp='Flag = 1' />
										</command>
										<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='Flag = 1' >
											<flowline >
												<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048578' mask='2' exp='TimerStart' />
												<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='TimerStart = 0' swap='0' >
													<flowline >
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Timer2' macro='StartCounter' >
															<argument exp='1' />
														</command>
														<command class_type='label' title='Connection Point' cmdcolor='12615680' cmdcolor_sec='15376912' labelid='0' labelname='A' />
														<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='1' port='1048578' mask='4' exp='TimerStop' />
														<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='TimerStop = 1' swap='0' >
															<flowline >
																<command class_type='goto' title='Goto Connection Point' cmdcolor='12615680' cmdcolor_sec='15376912' labelid='0' labelname='' />
															</flowline>
															<flowline >
																<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Timer2' macro='StopCounter' />
																<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Timer2' macro='GetCountMilliseconds' >
																	<return exp='Count' />
																</command>
																<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Timer2' macro='ResetCounter' />
															</flowline>
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='SetInt' >
															<argument exp='0' />
															<argument exp='Limit' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte0' />
															<argument exp='0' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte1' />
															<argument exp='1' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte2' />
															<argument exp='2' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte3' />
															<argument exp='3' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte4' />
															<argument exp='4' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte4' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte3' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte2' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte1' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte0' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Timer2' macro='ResetCounter' />
														<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='1' type='1' />
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='SetInt' >
															<argument exp='0' />
															<argument exp='Count' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte0' />
															<argument exp='0' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte1' />
															<argument exp='1' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte2' />
															<argument exp='2' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte3' />
															<argument exp='3' />
														</command>
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='TypeConversions1' macro='GetByte' >
															<return exp='Byte4' />
															<argument exp='4' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte4' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte3' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte2' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte1' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
															<argument exp='Byte0' />
														</command>
														<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='Timer2' macro='ResetCounter' />
														<command class_type='comment' title='' comment='This value for SP3014 is 3000 for 24V and 6000 for 12V. Count in uS
is approx time for 0.5 revolution of motor.' textarea='12,0,12,0' cmdcolor='10944511' cmdcolor_sec='11465458' />
														<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Count &gt; Limit' swap='0' >
															<flowline >
																<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048578' mask='16' exp='0' />
																<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048578' mask='32' exp='1' />
															</flowline>
															<flowline >
																<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048578' mask='16' exp='1' />
																<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048578' mask='32' exp='0' />
															</flowline>
														</command>
														<command class_type='delay' title='' cmdcolor='12632064' cmdcolor_sec='16769676' exp='10' type='1' />
														<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
															<exp exp='Flag = 0' />
														</command>
													</flowline>
													<flowline />
												</command>
											</flowline>
										</command>
									</flowline>
									<flowline />
								</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='set_bit(trisa,4);
set_bit(trisa,5);
trisb = 0x0F;
PORTC = 0x00;
clear_bit(trisc,0);
clear_bit(trisc,3);
clear_bit(trisc,4);
clear_bit(trisc,5);
set_bit(trisc,1);
set_bit(trisc,2);' cmdcolor='7687168' cmdcolor_sec='8152576' language='C' />
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048576' mask='16' exp='0' />
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048576' mask='32' exp='0' />
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048577' mask='16' exp='0' />
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048577' mask='32' exp='0' />
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048578' mask='1' exp='0' />
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048578' mask='8' exp='0' />
						<command class_type='native' title='weak pullups on' ccode='clear_bit(OPTION_REG,7);
WPUB = 0x0F;' cmdcolor='7687168' cmdcolor_sec='8152576' language='C' />
						<command class_type='goto' title='Goto Connection Point' cmdcolor='12615680' cmdcolor_sec='15376912' labelid='0' labelname='' />
						<command class_type='calculation' title='Initialise Return Value' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='retval = 1' />
						</command>
						<command class_type='loop' title='Wait for card to start up' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='retval &gt; 0' >
							<flowline >
								<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='1' type='2' />
								<command class_type='call' title='Init FAT16' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='Initialise' >
									<return exp='retval' />
								</command>
							</flowline>
						</command>
						<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='1' type='1' />
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048576' mask='32' exp='1' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='Initialise' />
						<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='1' type='1' />
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='retval = 1' />
						</command>
						<command class_type='input' title='Input' cmdcolor='4664832' cmdcolor_sec='4470784' mode='2' port='1048577' mask='15' exp='ProductSelect' />
						<command class_type='switch' title='Select Jig variant' textarea='36,25,36,25' cmdcolor='12615680' cmdcolor_sec='15376912' exp='ProductSelect' >
							<case >
								<flowline />
							</case>
							<case exp='14' >
								<flowline >
									<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='OpenFile' >
										<return exp='retval' />
										<argument exp='&quot;1.txt&quot;' />
									</command>
								</flowline>
							</case>
							<case exp='13' >
								<flowline >
									<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='OpenFile' >
										<return exp='retval' />
										<argument exp='&quot;2.txt&quot;' />
									</command>
								</flowline>
							</case>
							<case exp='12' >
								<flowline >
									<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='OpenFile' >
										<return exp='retval' />
										<argument exp='&quot;3.txt&quot;' />
									</command>
								</flowline>
							</case>
							<case exp='11' >
								<flowline >
									<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='OpenFile' >
										<return exp='retval' />
										<argument exp='&quot;4.txt&quot;' />
									</command>
								</flowline>
							</case>
							<case exp='10' >
								<flowline >
									<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='OpenFile' >
										<return exp='retval' />
										<argument exp='&quot;5.txt&quot;' />
									</command>
								</flowline>
							</case>
							<case exp='9' >
								<flowline >
									<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='OpenFile' >
										<return exp='retval' />
										<argument exp='&quot;6.txt&quot;' />
									</command>
								</flowline>
							</case>
							<case exp='8' >
								<flowline >
									<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='OpenFile' >
										<return exp='retval' />
										<argument exp='&quot;7.txt&quot;' />
									</command>
								</flowline>
							</case>
							<case exp='7' >
								<flowline >
									<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='OpenFile' >
										<return exp='retval' />
										<argument exp='&quot;7.txt&quot;' />
									</command>
								</flowline>
							</case>
							<case exp='6' >
								<flowline >
									<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='OpenFile' >
										<return exp='retval' />
										<argument exp='&quot;7.txt&quot;' />
									</command>
								</flowline>
							</case>
						</command>
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='retval = 0' swap='1' >
							<flowline >
								<command class_type='output' title='Advise main gear data coming' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048577' mask='16' exp='1' />
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
									<argument exp='&quot;Data Not Found&quot;' />
								</command>
								<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='1' type='1' />
							</flowline>
							<flowline />
						</command>
						<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='10' type='1' />
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='Test = Length$ (StrData)' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FAT1' macro='ReadStringFromFile' >
							<return exp='StrData' />
							<argument exp='50' />
							<argument exp='5555' />
						</command>
						<command class_type='output' title='Advise main gear data coming' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048577' mask='16' exp='1' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
							<argument exp='StrData' />
						</command>
						<command class_type='output' title='Output' cmdcolor='16762795' cmdcolor_sec='13879979' mode='1' port='1048577' mask='16' exp='0' />
						<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='Direction' />
						<command class_type='comment' title='' comment='Code below here not relevant to operation but program won&apos;t 
work without it. Check out if time later.' textarea='12,0,12,0' cmdcolor='10944511' cmdcolor_sec='11465458' />
						<command class_type='goto' title='Goto Connection Point' cmdcolor='12615680' cmdcolor_sec='15376912' labelid='1' labelname='' />
						<command class_type='interrupt' title='Interrupt' cmdcolor='17151' cmdcolor_sec='355583' enable='1' name='' call='CCP1_Int' >
							<custom name='CCP1_Int' handler='if( PIR1 &amp; (1 &lt;&lt; CCP1IF))
{
FCM_%n(); // call selected macro
clear_bit(PIR1, CCP1IF); // clear interrupt
}' enable='INTCONbits.PEIE = 1;
INTCONbits.GIE = 1;
CCP1CON =0x05;    //capture on rising edge of CCP1

PIR1bits.CCP1IF = 0; // Clear pending CCP1 interrupts
PIE1bits.CCP1IE = 1; // Enable CCP1 interrupts
INTCONbits.PEIE = 1; // Enable peripheral interrupts
INTCONbits.GIE = 1; // Enable global interrupts
T1CON = 1; // Enable Timer 1' disable='' />
						</command>
						<command class_type='interrupt' title='Interrupt' cmdcolor='17151' cmdcolor_sec='355583' enable='1' name='' call='CCP2_Int' >
							<custom name='CCP2_Int' handler='if (PIR2 &amp; (1 &lt;&lt; CCP2IF))
{
FCM_%n(); // call selected macro
clear_bit(PIR2, CCP2IF); // clear interrupt
}' enable='INTCONbits.PEIE = 1;
INTCONbits.GIE = 1;
CCP2CON =0x05;    //capture on rising edge of CCP2

PIR2bits.CCP2IF = 0; // Clear pending CCP2 interrupts
PIE2bits.CCP2IE = 1; // Enable CCP2 interrupts
INTCONbits.PEIE = 1; // Enable peripheral interrupts
INTCONbits.GIE = 1; // Enable global interrupts
T1CON = 1; // Enable Timer 1' disable='' />
						</command>
						<command class_type='label' title='Connection Point' cmdcolor='12615680' cmdcolor_sec='15376912' labelid='1' labelname='B' />
					</flowline>
				</macro>
				<macro >
					<flowline name='CCP2_Int' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='C Code' ccode='FCV_HIGH = TMR1H;
FCV_LOW = TMR1L;' cmdcolor='7687168' cmdcolor_sec='8152576' language='C' />
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='0b61bd39-05a3-46ee-a2a5-da7bffb583c5' vmin='0' vmaj='3' codename='FAT1' x='0' y='10' 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='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='cal_spi::CHANNEL' data='000' />
					<value target='cal_spi::MOSI' data='$PORTA.0' />
					<value target='cal_spi::MOSIPins' data='008' />
					<value target='cal_spi::MISO' data='$PORTA.1' />
					<value target='cal_spi::MISOPins' data='013' />
					<value target='cal_spi::CLK' data='$PORTA.2' />
					<value target='cal_spi::CLKPins' data='004' />
					<value target='cal_spi::SS' data='$PORTA.3' />
					<value target='PR_SCALE' data='064' />
					<value target='PR_SCALE2' data='004' />
					<value target='max_concurrent_files' data='1' />
					<value target='EOFtype' data='000' />
					<value target='AutoInsertCard' data='1' />
					<value target='SimType' data='000' />
					<value target='root_dir' data='$(srcdir)' />
					<value target='cal_spi::ScopeTraces' data='0' />
					<value target='cal_spi::ConsoleData' data='0' />
					<value target='cal_spi::Injector' data='000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='c73616d1-7ad0-45d9-aada-69ccfa4c5efc' vmin='0' vmaj='2' codename='UART1' x='-20' y='30' z='0' xsz='66' ysz='34' zsz='7.5' 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='$PORTC.6' />
					<value target='cal_uart::OutputPins' data='007' />
					<value target='cal_uart::TXAlt' data='0' />
					<value target='cal_uart::UseRX' data='0' />
					<value target='cal_uart::RX' data='$PORTC.7' />
					<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='UART' />
					<value target='cal_uart::ScopeTraces' data='0' />
					<value target='cal_uart::ConsoleData' data='0' />
					<value target='cal_uart::ConsoleFormat' data='000' />
					<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='24ad2718-c70b-4088-aeda-3949dfdba740' vmin='1' vmaj='1' codename='Timer2' x='-210' y='-180' 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='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='Timer' data='002' />
					<value target='BitDepth' data='8' />
					<value target='InstructionRate' data='2500000' />
					<value target='InstructionTime' data='0.000400' />
					<value target='RolloverFreq' data='9765.625000' />
					<value target='RolloverTime' data='0.000102' />
					<value target='RegHighUsed' data='0' />
					<value target='Instance' data='1' />
					<value target='DeviceBits' data='8' />
					<value target='CountRegLow' data='TMR2' />
					<value target='CountRegHigh' data='' />
					<value target='EnableCode' data='st_bit(INTCON,GIE); st_bit(PIE1, TMR2IE);  st_bit(INTCON,PEIE); cr_bit(T2CON,T2CKPS0); cr_bit(T2CON,T2CKPS1); st_bit(T2CON,TMR2ON);  T2CON = T2CON &amp; 0x07; ' />
					<value target='DisableCode' data='cr_bit(PIE1, TMR2IE); ' />
					<value target='HandlerCode' data='if (ts_bit(PIR1, TMR2IF) &amp;&amp; ts_bit(PIE1, TMR2IE)) {  TIM_1_INC  cr_bit(PIR1, TMR2IF); }' />
					<value target='MaxTimeMeasurement' data='1717.986938' />
					<value target='Family' data='PIC' />
					<value target='TimerDelay' data='50' />
					<value target='DecimalPoints' data='3' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='6508c7be-063a-4f9f-bae5-4a41cf977a86' vmin='0' vmaj='1' codename='TypeConversions1' x='0' y='0' z='11.15' 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='1' poslock='0' >
				<resources />
				<properties />
				<values />
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<scadaresourcelookup />
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' >
		<background rgb='7292207' img='' style='0' />
		<camera xe='48.1468' ye='-73.34' ze='1503.69' xt='48.1468' yt='-73.34' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='0' lighting='0' brightness='0' perspective='1' >
		<background rgb='16777215' img='' style='0' />
		<table rgb='8388608' img='' style='0' size='0' />
		<camera xe='-3.67394e-14' ye='0' ze='-300' xt='0' yt='0' zt='0' xquat='0' yquat='1' zquat='0' wquat='6.12323e-17' />
		<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='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAdQYAAFgDAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Direction' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAdQYAAFgDAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='CCP2_Int' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAdQYAAFgDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='CCP1_Int' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAdQYAAFgDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
