<root>
<document schema='101' license='1,Daniel Sallros,FXBWB0' title='' description='' target='PIC16.24F.24FJ64GA002' >
	<config data='!0,be7f!10,790f%0,f%4,1%5,1%6,1%7,0%8,2%a,1%b,1%c,1%d,1%e,0%f,1%10,3%12,1%13,1%14,0%15,0%16,0%18,1%1b,3%1d,3%1f,0' clkspd='16000000' simspd='1' usewdt='0' constif='0' />
	<plugins >
		<dll_dbg_icd enabled='0' >
			<data name='debug' value='1' />
			<data name='userpins' value='0' />
			<data name='speed' value='1000' />
			<data name='usev9' value='0' />
			<data name='breaks' value='8' />
			<data name='stacks' value='8' />
			<data name='clkport' value='1' />
			<data name='clkbit' value='6' />
			<data name='dataport' value='1' />
			<data name='databit' value='7' />
			<data name='ghostype' value='0' />
			<data name='monitor' value='1' />
			<data name='ictloop' value='1' />
			<data name='ictrate' value='1000' />
			<data name='ictmask' value='-1' />
		</dll_dbg_icd>
		<dll_models enabled='1' />
		<dll_upgrader enabled='1' />
		<dll_webhelp enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug >
		<watch expr='flushbuffer' />
		<watch expr='arrcur' />
		<watch expr='arrstartread' />
		<watch expr='totalwrites' />
		<watch expr='getnext' />
		<watch expr='ain' />
		<watch expr='ain2' />
		<watch expr='ain_temp' />
	</debug>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='1d3ea4f1-8249-4b58-a252-db8caab83e37' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='Misc' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='0' 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' interactive='1' solid='1' layer='1' poslock='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='arrstartread' type='u16' description='where cut' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='filename_full' type='T8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='20' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='ain_temp' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</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='pas_max' type='s16' description='maximum pas length' isconst='1' isinit='1' usrinit='30' setinit='30' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='u' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='arrcur' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='INT_Flag' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='accumulate_total' type='s16' description='total -1 (eg. 3 times + 1 last)' isconst='1' isinit='1' usrinit='3' setinit='3' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='ain' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='pas_min' type='s16' description='minimum pas length' isconst='1' isinit='1' usrinit='15' setinit='15' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='flushbuffer' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='arr' type='u8' description='round buffer' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='5100' />
					</def>
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='INT_Routine' description='' >
						<command class_type='calculation' title='Calculation' >
							<exp exp='INT_Flag = 1' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='FATinit' description='' >
						<command class_type='calculation' title='r' >
							<exp exp='retval = 1' />
						</command>
						<command class_type='loop' title='Loop' type='0' exp='retval &gt; 0' >
							<flowline >
								<command class_type='call' title='Call Component Macro' ccode='// Call Component Macro
// Call Component Macro: retval=FAT1::Initialise()
FCV_RETVAL = FCD_07fa1_FAT1__Initialise();
' component='FAT1' macro='Initialise' >
									<return exp='retval' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' >
						<command class_type='delay' title='Delay' exp='1' type='2' />
						<command class_type='call' title='Call Macro' macro='FATinit' />
						<command class_type='call' title='Call Component Macro' component='adc_base1' macro='RawEnable' />
						<command class_type='loop' title='Loop' type='0' exp='1' >
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='filename_full = &quot;data.dat&quot;' />
									<exp exp='arrcur = 0' />
								</command>
								<command class_type='call' title='s' ccode='// s
// Call Component Macro: FAT1::CreateFile(filename_full)
FCD_07fa1_FAT1__CreateFile(FCV_FILENAME_FULL, FCVsz_FILENAME_FULL);
' component='FAT1' macro='DeleteFile' >
									<argument exp='filename_full' />
								</command>
								<command class_type='call' title='Call Component Macro' component='FAT1' macro='CreateFile' >
									<argument exp='filename_full' />
								</command>
								<command class_type='call' title='Call Component Macro' component='FAT1' macro='OpenFile' >
									<argument exp='filename_full' />
								</command>
								<command class_type='interrupt' title='Interrupt' enable='1' name='TMR1' call='INT_Routine' >
									<settings timer='1' prescale='1' postscale='-1' rollover='1000' bitcount='-1' trigger='3' maskhi='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
										<option value='0' />
										<option value='0' />
										<option value='1000' />
										<option value='-1' />
									</settings>
								</command>
								<command class_type='loop' title='' type='0' exp='1' >
									<flowline >
										<command class_type='decision' title='Decision' exp='INT_Flag = 1' swap='0' >
											<flowline >
												<command class_type='call' title='Call Component Macro' component='adc_base1' macro='GetByte' >
													<return exp='ain' />
												</command>
												<command class_type='calculation' title='Calculation' >
													<exp exp='ain = ain_temp //overwrite with temp data' />
													<exp exp='arr[arrcur] = ain //put to circular buffer' />
													<exp exp='ain_temp = ain_temp + 1 //increase temp data' />
												</command>
												<command class_type='decision' title='if reached end of buffer and still flushing fat, then skip all' exp='((arrcur = 2047) OR (arrcur = 4095)) AND (flushbuffer)' swap='0' >
													<flowline >
														<command class_type='goto' title='Goto Connection Point' labelid='0' labelname='' />
													</flowline>
													<flowline />
												</command>
												<command class_type='decision' title='if half of buffer passed' exp='(arrcur = 2047) OR (arrcur = 4095)' swap='0' >
													<flowline >
														<command class_type='interrupt' title='Interrupt' break='1' enable='0' name='TMR1' >
															<settings timer='1' prescale='1' postscale='-1' rollover='0' bitcount='-1' trigger='3' maskhi='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
																<option value='0' />
																<option value='0' />
																<option value='0' />
																<option value='0' />
															</settings>
														</command>
														<command class_type='decision' title='if filled first part' exp='arrcur = 2047' swap='0' >
															<flowline >
																<command class_type='calculation' title='start from buffer start' >
																	<exp exp='arrstartread = 0' />
																	<exp exp='arrcur = arrcur + 1' />
																</command>
															</flowline>
															<flowline >
																<command class_type='calculation' title='else start from middle' >
																	<exp exp='arrstartread = 2048 //start from middle' />
																	<exp exp='arrcur = 0 //index to start' />
																</command>
															</flowline>
														</command>
														<command class_type='calculation' title='Calculation' >
															<exp exp='flushbuffer = 1' />
														</command>
													</flowline>
													<flowline >
														<command class_type='calculation' title='Calculation' >
															<exp exp='arrcur = arrcur + 1' />
														</command>
													</flowline>
												</command>
												<command class_type='label' title='Connection Point' labelid='0' labelname='A' />
												<command class_type='calculation' title='Calculation' >
													<exp exp='INT_Flag = 0' />
												</command>
											</flowline>
											<flowline />
										</command>
										<command class_type='decision' title='Decision' exp='flushbuffer' swap='0' >
											<flowline >
												<command class_type='call' title='Call Component Macro' component='led_shape1' macro='TurnOn' />
												<command class_type='loop' title='Loop' type='2' exp='4' >
													<flowline >
														<command class_type='loop' title='fill fat buffer' type='2' forvar='u' exp='512' >
															<flowline >
																<command class_type='call' title='Call Component Macro' component='FAT1' macro='WriteByteToBuffer' >
																	<argument exp='u' />
																	<argument exp='arr[arrstartread]' />
																</command>
																<command class_type='calculation' title='Calculation' >
																	<exp exp='arrstartread = arrstartread + 1' />
																</command>
															</flowline>
														</command>
														<command class_type='call' title='Call Component Macro' component='FAT1' macro='WriteFileSector' />
														<command class_type='call' title='Call Component Macro' component='FAT1' macro='MoveToNextFileSector' >
															<argument exp='1' />
														</command>
													</flowline>
												</command>
												<command class_type='call' title='Call Component Macro' component='led_shape1' macro='TurnOff' />
												<command class_type='calculation' title='Calculation' >
													<exp exp='flushbuffer = 0' />
												</command>
												<command class_type='interrupt' title='Interrupt' enable='1' name='TMR1' call='INT_Routine' >
													<settings timer='1' prescale='1' postscale='-1' rollover='1000' bitcount='-1' trigger='3' maskhi='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
														<option value='0' />
														<option value='0' />
														<option value='1000' />
														<option value='-1' />
													</settings>
												</command>
											</flowline>
											<flowline />
										</command>
									</flowline>
								</command>
								<command class_type='native' title='C Code' disable='1' ccode='/*
  Enter C code below this comment
*/
__asm__ volatile (&quot;reset&quot;);' language='C' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='248e0a81-43e3-4ff7-b87d-69c04add1fb9' vmin='1' vmaj='0' codename='led_shape1' x='-16' y='-16' z='0.5' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pin' data='$PORTB.11' />
					<value target='polarity' data='000' />
					<value target='on_color' data='255' />
					<value target='Shape' data='000' />
					<value target='width' data='22.000000' />
					<value target='height' data='22.000000' />
					<value target='depth' data='1.000000' />
					<value target='show_label' data='002' />
					<value target='label_property' data='pin' />
					<value target='label_color' data='16777215' />
					<value target='label_scale' data='1.000000' />
					<value target='label_auto_scale' data='0' />
					<value target='label_position' data='003' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='0b61bd39-05a3-46ee-a2a5-da7bffb583c5' vmin='2' vmaj='2' codename='FAT1' x='34' y='3.18519' z='1.4' xsz='1.42857' ysz='1.41707' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='max_concurrent_files' data='1' />
					<value target='Channel' data='001' />
					<value target='PR_SCALE' data='004' />
					<value target='cs_pin' data='$PORTB.15' />
					<value target='mosi_pin' data='$PORTB.14' />
					<value target='miso_pin' data='$PORTB.6' />
					<value target='sck_pin' data='$PORTB.7' />
					<value target='MosiRemap' data='014' />
					<value target='MisoRemap' data='006' />
					<value target='ClkRemap' data='007' />
					<value target='root_dir' data='C:\FC\' />
					<value target='AutoInsertCard' data='1' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='7aad74d6-b24e-4dab-91eb-5d72a973f12d' vmin='2' vmaj='1' codename='adc_base1' x='0' y='32' z='0' xsz='25' ysz='25' zsz='25' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='channel' data='11' />
					<value target='vrefvol' data='500' />
					<value target='vrefop' data='000' />
					<value target='convspd' data='000' />
					<value target='actime' data='1' />
					<value target='bits' data='10' />
					<value target='bitmul' data='0.004883' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='9d687cd1-0972-49af-b179-46df5fdc55fe' vmin='6' vmaj='0' codename='flasheeprom1' x='24' y='96' z='2.70886' xsz='0.307692' ysz='0.4' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values />
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' perspective='0' >
		<background rgb='9737364' img='' style='0' />
		<camera xe='0' ye='0' ze='188.615' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='0' lighting='2' brightness='0' perspective='0' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='25' />
		<camera xe='-0.509088' ye='-11.0114' ze='111.087' xt='0' yt='0' zt='0' xquat='-0.0494198' yquat='0.0011418' zquat='0.0230697' wquat='0.998511' />
	</panel3d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAjAAAAWQQAAHoDAAA' zoom='36' scrollx='0' scrolly='1026' flags='0' />
		<view type='0' name='INT_Routine' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAjAAAAWQQAAHoDAAA' zoom='30' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='FATinit' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAjAAAAWQQAAHoDAAA' zoom='45' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
