<root>
<document scada='0' projtype='1' schema='103' license='1,82702381,95CJQR' title='' description='' fcversion='720899' target='PIC.18F.ECIO-40' >
	<config data='' clkspd='48000000' simspd='1' usewdt='0' constif='0' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<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='2' />
			<data name='ClockPin' value='4' />
			<data name='DataPort' value='4' />
			<data name='DataPin' value='2' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='4' />
			<data name='CalculatedCommsDelay' value='4' />
			<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='' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' category2='' category3='' bIs2dOnly='0' bIs3dOnly='0' bIsWysiwyg='0' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='0' scadaCompatible='0' embeddedCompatible='1' showmacros='1' iconpath='' />
		<component class_type='root' codename='panel' panelId='-1' 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' ancTop='0' ancBottom='0' ancLeft='0' ancRight='0' ancMinX='0' ancMinY='0' angle2d='0' comp2dType='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='ADC_Val' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='filename' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='20' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='char3' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='char2' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='char1' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='retval' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='idx' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='filestring' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='3' />
					</def>
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='Byte_2_4Char_Buffer' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='in' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='calculation' title='Convert ADC Sample to String' >
							<exp exp='filestring = ToString$ (ADC_Val)' />
						</command>
						<command class_type='decision' title='If String is 3 characters' exp='Byte_2_4Char_Buffer.in &gt; 100' swap='0' >
							<flowline />
							<flowline >
								<command class_type='decision' title='If String is 2 characters' exp='Byte_2_4Char_Buffer.in &gt; 10' swap='0' >
									<flowline >
										<command class_type='calculation' title='Add a character' >
											<exp exp='filestring = &quot;0&quot; + filestring' />
										</command>
									</flowline>
									<flowline >
										<command class_type='calculation' title='Add 2 characters' >
											<exp exp='filestring = &quot;00&quot; + filestring' />
										</command>
									</flowline>
								</command>
							</flowline>
						</command>
						<command class_type='calculation' title='String Manipulation' >
							<exp exp='char1 = Char$ (filestring,0)' />
							<exp exp='char2 = Char$ (filestring,1)' />
							<exp exp='char3 = Char$ (filestring,2)' />
						</command>
						<command class_type='call' title='Write 1st Byte to Buffer' component='FAT1' macro='WriteByteToBuffer' >
							<argument exp='idx' />
							<argument exp='char1' />
						</command>
						<command class_type='calculation' title='Increment Buffer Index' >
							<exp exp='idx = idx + 1' />
						</command>
						<command class_type='call' title='Write 2nd Byte to Buffer' component='FAT1' macro='WriteByteToBuffer' >
							<argument exp='idx' />
							<argument exp='char2' />
						</command>
						<command class_type='calculation' title='Increment Buffer Index' >
							<exp exp='idx = idx + 1' />
						</command>
						<command class_type='call' title='Write 3rd Byte to Buffer' component='FAT1' macro='WriteByteToBuffer' >
							<argument exp='idx' />
							<argument exp='char3' />
						</command>
						<command class_type='calculation' title='Increment Buffer Index' >
							<exp exp='idx = idx + 1' />
						</command>
						<command class_type='call' title='Write Comma' component='FAT1' macro='WriteByteToBuffer' >
							<argument exp='idx' />
							<argument exp='&quot;,&quot;' />
						</command>
						<command class_type='calculation' title='Increment Buffer Index' >
							<exp exp='idx = idx + 1' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<command class_type='call' title='Start LCd' component='LCD1' macro='Start' />
						<command class_type='call' title='Print Startup String' component='LCD1' macro='PrintString' >
							<argument exp='&quot;Waiting for Card&quot;' />
						</command>
						<command class_type='calculation' title='Assign filename and data' >
							<exp exp='filename = &quot;log2.txt&quot;' />
							<exp exp='filestring = &quot;&quot;' />
						</command>
						<command class_type='calculation' title='Initialise Return Value' >
							<exp exp='retval = 1' />
						</command>
						<command class_type='loop' title='Wait for card to start up' type='0' exp='retval &gt; 0' for1='' for3='' >
							<flowline >
								<command class_type='delay' title='Delay' exp='1' type='2' />
								<command class_type='call' title='Init FAT16' component='FAT1' macro='Initialise' >
									<return exp='retval' />
								</command>
							</flowline>
						</command>
						<command class_type='call' title='Clear Display' component='LCD1' macro='Clear' />
						<command class_type='call' title='Print Creating File' component='LCD1' macro='PrintString' >
							<argument exp='&quot;Creating File&quot;' />
						</command>
						<command class_type='call' title='Move to next line of LCD' component='LCD1' macro='Cursor' >
							<argument exp='0' />
							<argument exp='1' />
						</command>
						<command class_type='call' title='Create File' component='FAT1' macro='CreateFile' >
							<return exp='retval' />
							<argument exp='filename' />
						</command>
						<command class_type='decision' title='Decision' exp='retval' swap='0' >
							<flowline >
								<command class_type='call' title='File Error' component='LCD1' macro='PrintString' >
									<argument exp='&quot;File Exists&quot;' />
								</command>
							</flowline>
							<flowline >
								<command class_type='call' title='File OK' component='LCD1' macro='PrintString' >
									<argument exp='&quot;File Created&quot;' />
								</command>
								<command class_type='delay' title='Delay' exp='5' type='2' />
								<command class_type='call' title='Clear Display' component='LCD1' macro='Clear' />
								<command class_type='call' title='Print Opening File' component='LCD1' macro='PrintString' >
									<argument exp='&quot;Opening File&quot;' />
								</command>
								<command class_type='call' title='Move to next line of LCD' component='LCD1' macro='Cursor' >
									<argument exp='0' />
									<argument exp='1' />
								</command>
								<command class_type='call' title='Open the file' component='FAT1' macro='OpenFile' >
									<return exp='retval' />
									<argument exp='filename' />
								</command>
								<command class_type='decision' title='Decision' exp='retval' swap='0' >
									<flowline >
										<command class_type='call' title='File Error' component='LCD1' macro='PrintString' >
											<argument exp='&quot;File Error&quot;' />
										</command>
									</flowline>
									<flowline >
										<command class_type='call' title='File OK' component='LCD1' macro='PrintString' >
											<argument exp='&quot;File Opened&quot;' />
										</command>
										<command class_type='delay' title='Delay' exp='5' type='2' />
										<command class_type='call' title='Clear Display' component='LCD1' macro='Clear' />
										<command class_type='call' title='Print Writing Data' component='LCD1' macro='PrintString' >
											<argument exp='&quot;Writing Data&quot;' />
										</command>
										<command class_type='call' title='Move to next line of LCD' component='LCD1' macro='Cursor' >
											<argument exp='0' />
											<argument exp='1' />
										</command>
										<command class_type='loop' title='Fill up 5 disk sectors' type='2' exp='5' for1='' for3='' >
											<flowline >
												<command class_type='calculation' title='Initialise Buffer Index' >
													<exp exp='idx = 0' />
												</command>
												<command class_type='loop' title='Take 128 samples - 4 x 128 = 512 = full sector' type='2' exp='128' for1='' for3='' >
													<flowline >
														<command class_type='call' title='Read into byte Variable' component='Pot_Slider1' macro='GetInt' >
															<return exp='ADC_Val' />
														</command>
														<command class_type='call' title='Convert byte to 4 char ASCII' macro='Byte_2_4Char_Buffer' >
															<argument exp='ADC_Val' />
														</command>
													</flowline>
												</command>
												<command class_type='call' title='Write complete 512 byte sector to file' component='FAT1' macro='WriteFileSector' />
												<command class_type='call' title='Create Next 512 Byte Sector' component='FAT1' macro='MoveToNextFileSector' >
													<return exp='retval' />
													<argument exp='1' />
												</command>
											</flowline>
										</command>
										<command class_type='decision' title='Decision' exp='retval' swap='0' >
											<flowline >
												<command class_type='call' title='Write Error' component='LCD1' macro='PrintString' >
													<argument exp='&quot;Data Error&quot;' />
												</command>
											</flowline>
											<flowline >
												<command class_type='call' title='Write OK' component='LCD1' macro='PrintString' >
													<argument exp='&quot;Data Written&quot;' />
												</command>
											</flowline>
										</command>
									</flowline>
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='0953aac0-9c23-4c2f-9843-88954a4191ea' vmin='5' vmaj='2' codename='LCD1' panelId='0' x='144.323' y='-66.9988' z='0' xsz='25' ysz='25' zsz='1.14286' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='2' poslock='0' ancTop='0' ancBottom='0' ancLeft='0' ancRight='0' ancMinX='0' ancMinY='0' angle2d='0' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='LCD_Mode' data='000' />
					<value target='Pin_Data_0' data='$PORTB.0' />
					<value target='Pin_Data_1' data='$PORTB.1' />
					<value target='Pin_Data_2' data='$PORTB.2' />
					<value target='Pin_Data_3' data='$PORTB.3' />
					<value target='Pin_Data_4' data='$PORTA.1' />
					<value target='Pin_Data_5' data='$PORTA.1' />
					<value target='Pin_Data_6' data='$PORTA.1' />
					<value target='Pin_Data_7' data='$PORTA.1' />
					<value target='LCD_Port' data='$PORTA' />
					<value target='Pin_RS' data='$PORTB.4' />
					<value target='Pin_E' data='$PORTB.5' />
					<value target='LCD_Use_Write' data='0' />
					<value target='RemapCharacters' data='0' />
					<value target='Pin_RW' data='$PORTA.0' />
					<value target='Rows' data='2' />
					<value target='Columns' data='16' />
					<value target='ctrl_lcd::Base_GLCD1::ShowBackground' data='1' />
					<value target='ctrl_lcd::Base_GLCD1::ComponentLabel' data='000' />
					<value target='ctrl_lcd::Base_GLCD1::GdiText1::sText' data='panel' />
					<value target='ctrl_lcd::Base_GLCD1::GdiText1::dScale' data='1.400000' />
					<value target='ctrl_lcd::TextColour' data='0' />
					<value target='TextBg' data='14803425' />
					<value target='DispalyBg' data='16777215' />
					<value target='DelayTiming' data='100' />
					<value target='CursorPosX' data='0' />
					<value target='CursorPosY' data='0' />
					<value target='DoubleDelay' data='0' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='0b61bd39-05a3-46ee-a2a5-da7bffb583c5' vmin='0' vmaj='4' codename='FAT1' panelId='0' x='352.669' y='-99.7648' z='1' xsz='25' ysz='25' 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='2' poslock='0' ancTop='0' ancBottom='0' ancLeft='0' ancRight='0' ancMinX='0' ancMinY='0' angle2d='0' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='cal_spi::CHANNEL' data='001' />
					<value target='cal_spi::MOSI' data='$PORTC.7' />
					<value target='cal_spi::MOSIPins' data='008' />
					<value target='cal_spi::MISO' data='$PORTB.0' />
					<value target='cal_spi::MISOPins' data='013' />
					<value target='cal_spi::CLK' data='$PORTB.1' />
					<value target='cal_spi::CLKPins' data='004' />
					<value target='cal_spi::SS' data='$PORTC.2' />
					<value target='PR_SCALE' data='004' />
					<value target='PR_SCALE2' data='004' />
					<value target='max_concurrent_files' data='5' />
					<value target='EOFtype' data='001' />
					<value target='IsSim' data='0' />
					<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' />
					<value target='cal_spi1::InjectorCS' data='' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='3d8f329f-3bf9-4c90-8797-05100f6419f8' vmin='0' vmaj='1' codename='Pot_Slider1' panelId='0' x='470' y='-193' z='2' xsz='25' ysz='25' zsz='25' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='2' poslock='0' ancTop='0' ancBottom='0' ancLeft='0' ancRight='0' ancMinX='0' ancMinY='0' angle2d='0' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='adc_base1::channel' data='0' />
					<value target='adc_base1::vrefvol' data='500' />
					<value target='adc_base1::vrefop' data='000' />
					<value target='adc_base1::convspd' data='001' />
					<value target='adc_base1::actime' data='40' />
					<value target='adc_base1::bits' data='10' />
					<value target='VrefForCalculations' data='' />
					<value target='BitDepth' data='10' />
					<value target='SetValue' data='5.000050' />
					<value target='RetainValue' data='1' />
					<value target='ModifiedConnection' data='An 0' />
					<value target='ComponentLabel' data='000' />
					<value target='GdiText2::sText' data='Pot_Slider1' />
					<value target='ConnectionLabels' data='1' />
					<value target='ShowPinValue' data='1' />
					<value target='LabelColour' data='7895160' />
					<value target='GdiGauge1::nStyle' data='  1' />
					<value target='GdiGauge1::nPointerLinear' data='  0' />
					<value target='UpperBoundValue' data='5.000050' />
					<value target='adc_base1::ScopeTraces' data='0' />
					<value target='GdiGauge1::brFill' data='71776119061217280' />
					<value target='GdiGauge1::colFrameOutline' data='16777215' />
					<value target='GdiGauge1::brFrameFill' data='251262225375821824' />
					<value target='GdiGauge1::colPointerOutline' data='16777215' />
					<value target='GdiGauge1::brPointerFill' data='251262225375821824' />
					<value target='GdiGauge1::colText' data='16777215' />
					<value target='GdiGauge1::colTickMarkOutline' data='16777215' />
					<value target='GdiGauge1::brTickMarkFill' data='288090190566653952' />
					<value target='GdiGauge1::colCapOutline' data='16777215' />
					<value target='GdiGauge1::brCapFill' data='288090190566653952' />
					<value target='GdiGauge1::sMainImage' data='' />
					<value target='GdiGauge1::sCapImage' data='' />
					<value target='FlowcodeType' data='0' />
					<value target='Enabled' data='1' />
					<value target='Product' data='PIC' />
				</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='0' ye='0' ze='314.962' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<viewport dx='421' dy='849' zoom='161.737' fix_topleft='0' />
		<page x='1000' y='1000' show='0' rgb='7360576' />
		<winpos ID='7005' RectRecentFloat='1270,195,1920,645' RectRecentDocked='0,0,421,872' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='0' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
	</panel2d>
	<panel3d shadows='1' lighting='2' brightness='0' perspective='1' >
		<background rgb='8409120' img='' style='4' />
		<table rgb='13816530' img='' style='0' size='0' />
		<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' />
		<winpos ID='7004' RectRecentFloat='0,425,654,1002' RectRecentDocked='0,0,236,872' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='0' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
	</panel3d>
	<panels2d count='1' >
		<panel2d_0 id='0' name='NewPanel' type='0' >
			<winpos ID='1171' RectRecentFloat='688,247,1338,697' RectRecentDocked='957,141,1480,1013' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='1' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='1' />
			<background fill='288230376151053813' showgrid='1' gridstyle='0' gridsize='5' gridbrush='71776119075691740' snaptogrid='0' fitcomp='0' disp_x='300' disp_y='400' scale='100' disp_col='16777215' />
		</panel2d_0>
	</panels2d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAEgQAAGMDAAA' zoom='75' scrollx='0' scrolly='900' flags='0' />
	</layout>
</document>
</root>
