<root>
<document schema='101' license='1,Jac Kersing,FD8DR7' title='' description='' target='PIC16.30F.30F4013' >
	<config data='!0,8713!10,3f!20,87a3!30,310f!40,330f!50,7!60,c003%0,713%e,2%10,f%14,3%1f,0%20,3%24,2%27,1%28,7%2f,1%30,f%38,1%3c,3%40,f%48,3%4c,3%50,1%51,3%60,3%6e,1%6f,1' clkspd='48000000' 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' />
			<data name='anlpres' value='255' />
			<data name='digmask1' value='-1' />
			<data name='digmask2' 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='Data' />
		<watch expr='Count' />
		<watch expr='Index' />
		<watch expr='FFTData' />
	</debug>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='e77b23be-4600-4bb2-99f1-89ea16d7fb6c' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' 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='0' poslock='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='Count' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='samplesCollected' type='b1' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='lcdPos' type='u8' description='' isconst='0' isinit='1' usrinit='2' setinit='2' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='exitSampleLoop' type='b1' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</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='value' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Data' type='s16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Index' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='FFTData' type='u8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='16' />
					</def>
				</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='PlotFFTData' description='' >
						<command class_type='loop' title='Loop through frequency banks 0 - N/2' type='2' forvar='Index' exp='15' >
							<flowline >
								<command class_type='call' title='Colour White' component='gLCD_EBM001' macro='SetForegroundColour' >
									<argument exp='255' />
									<argument exp='255' />
									<argument exp='255' />
								</command>
								<command class_type='call' title='Remove old line' component='gLCD_EBM001' macro='DrawLine' >
									<argument exp='Index' />
									<argument exp='0' />
									<argument exp='Index' />
									<argument exp='159' />
								</command>
								<command class_type='call' title='Colour Black' component='gLCD_EBM001' macro='SetForegroundColour' >
									<argument exp='0' />
									<argument exp='0' />
									<argument exp='0' />
								</command>
								<command class_type='call' title='Call Component Macro' component='gLCD_EBM001' macro='DrawLine' >
									<argument exp='Index' />
									<argument exp='159 - (FFTData[Index] &gt;&gt; 1)' />
									<argument exp='Index' />
									<argument exp='159' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Timer_tick' description='' >
						<command class_type='call' title='Read ADC as 10-bit INT' component='pot_ptr_black1' macro='RawSampleInt' >
							<return exp='Data' />
						</command>
						<command class_type='calculation' title='Convert 10-bit ADC reading to full scale +/- 16-bit' >
							<exp exp='Data = Data - 2048' />
							<exp exp='Data = Data * 16' />
						</command>
						<command class_type='call' title='Pass data into DSP chain' component='DSPInput1' macro='AddRawTick' >
							<argument exp='Data' />
						</command>
						<command class_type='call' title='Move to next buffer location' component='DSPSystem' macro='TickSpecificBuffer' >
							<argument exp='0' />
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='Count = Count + 1' />
						</command>
						<command class_type='decision' title='32 Samples?' exp='Count = 32' swap='0' >
							<flowline >
								<command class_type='interrupt' title='Interrupt' 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='calculation' title='Done sampling (for now)' >
									<exp exp='samplesCollected = true' />
								</command>
							</flowline>
							<flowline />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' >
						<command class_type='call' title='Initialise DSP buffers' component='DSPSystem' macro='Initialise' />
						<command class_type='call' title='Call Component Macro' component='gLCD_EBM001' macro='Initialise' />
						<command class_type='call' title='Call Component Macro' component='gLCD_EBM001' macro='ClearDisplay' />
						<command class_type='call' title='Call Component Macro' component='gLCD_EBM001' macro='Print' >
							<argument exp='&quot;       FFT Test&quot;' />
							<argument exp='5' />
							<argument exp='5' />
							<argument exp='0' />
							<argument exp='0' />
						</command>
						<command class_type='call' title='Call Component Macro' component='pot_ptr_black1' macro='RawEnable' />
						<command class_type='loop' title='Loop' type='0' exp='1' >
							<flowline >
								<command class_type='calculation' title='No samples collected yet, initialize variables' >
									<exp exp='samplesCollected = false' />
									<exp exp='Count = 1' />
									<exp exp='exitSampleLoop = false' />
								</command>
								<command class_type='interrupt' title='Interrupt to Timer_tick-4800hz' enable='1' name='TMR1' call='Timer_tick' >
									<settings timer='1' prescale='1' postscale='-1' rollover='2500' bitcount='-1' trigger='3' maskhi='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
										<option value='0' />
										<option value='0' />
										<option value='2500' />
										<option value='-1' />
									</settings>
								</command>
								<command class_type='loop' title='Need to keep waiting?' type='0' exp='exitSampleLoop = false' >
									<flowline >
										<command class_type='decision' title='Done sampling?' exp='samplesCollected = true' swap='0' >
											<flowline >
												<command class_type='call' title='Perfrom FFT' component='DSPFFT1' macro='FFT' />
												<command class_type='loop' title='Loop through frequency banks 0 - N/2' type='2' forvar='Index' exp='15' >
													<flowline >
														<command class_type='call' title='Call Component Macro' component='DSPFFT1' macro='ReadFrequencyBank' >
															<return exp='FFTData[Index]' />
															<argument exp='Index' />
														</command>
													</flowline>
												</command>
												<command class_type='call' title='Call Macro' macro='PlotFFTData' />
												<command class_type='calculation' title='Exit the loop' >
													<exp exp='exitSampleLoop = true' />
												</command>
											</flowline>
											<flowline />
										</command>
									</flowline>
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='917f243e-4102-4bee-9998-81f18bc6ca9d' vmin='2' vmaj='1' codename='DSPSystem' x='-112' y='96' z='2.5' xsz='32' ysz='32' zsz='5' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='buffer_count' data='003' />
					<value target='simple_mode' data='1' />
					<value target='DSPsystem_ID' data='1' />
					<value target='buff_a_name' data='Input' />
					<value target='buff_b_name' data='FFT_Real' />
					<value target='buff_c_name' data='FFT_Imag' />
					<value target='buff_d_name' data='Buffer D' />
					<value target='buff_e_name' data='Buffer E' />
					<value target='buff_f_name' data='Buffer F' />
					<value target='buff_g_name' data='Buffer G' />
					<value target='buff_h_name' data='Buffer H' />
					<value target='buff_a_depth' data='001' />
					<value target='buff_a_sign' data='000' />
					<value target='buff_a_size' data='32' />
					<value target='buff_b_depth' data='001' />
					<value target='buff_b_sign' data='000' />
					<value target='buff_b_size' data='32' />
					<value target='buff_c_depth' data='001' />
					<value target='buff_c_sign' data='000' />
					<value target='buff_c_size' data='32' />
					<value target='buff_d_depth' data='001' />
					<value target='buff_d_sign' data='000' />
					<value target='buff_d_size' data='32' />
					<value target='buff_e_depth' data='001' />
					<value target='buff_e_sign' data='000' />
					<value target='buff_e_size' data='32' />
					<value target='buff_f_depth' data='001' />
					<value target='buff_f_sign' data='000' />
					<value target='buff_f_size' data='32' />
					<value target='buff_g_depth' data='001' />
					<value target='buff_g_sign' data='000' />
					<value target='buff_g_size' data='32' />
					<value target='buff_h_depth' data='001' />
					<value target='buff_h_sign' data='000' />
					<value target='buff_h_size' data='32' />
					<value target='buff_simp_depth' data='001' />
					<value target='buff_simp_sign' data='000' />
					<value target='buff_simp_size' data='32' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='d7e01665-00e9-4091-8aa6-b9a0dd265bce' vmin='4' vmaj='1' codename='pot_ptr_black1' x='-152' y='96' z='7' xsz='21.5102' ysz='21.5102' zsz='14' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' 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='8' />
					<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='c73d493a-b6a0-4dbe-b4b5-79648f67d11e' vmin='2' vmaj='1' codename='DSPInput1' x='-152' y='56' z='2.98251' xsz='32' ysz='24' zsz='5.965' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='buffer_manager' data='001' />
					<value target='input_a' data='000' />
					<value target='size_a' data='32' />
					<value target='depth_a' data='001' />
					<value target='sign_a' data='000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='f804a7bd-0280-4ff7-ab75-63be77fb2af3' vmin='2' vmaj='1' codename='DSPFFT1' x='-100' y='56' z='2.98251' xsz='48' ysz='32' zsz='5.965' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='buffer_manager' data='001' />
					<value target='input_a' data='000' />
					<value target='output_c' data='001' />
					<value target='output_i' data='002' />
					<value target='size_a' data='32' />
					<value target='size_o' data='32' />
					<value target='depth_a' data='001' />
					<value target='depth_o' data='001' />
					<value target='sign_a' data='000' />
					<value target='sign_o' data='000' />
					<value target='size_j' data='32' />
					<value target='depth_j' data='001' />
					<value target='sign_j' data='000' />
					<value target='buff_len' data='5' />
					<value target='FFT_accuracy' data='005' />
					<value target='bit_depth' data='001' />
					<value target='sim_len' data='32' />
					<value target='sin_shift' data='14' />
					<value target='sample_rate' data='4800.000000' />
					<value target='nyquist' data='2400.000000' />
					<value target='bin_count' data='16' />
					<value target='bin_size' data='150.000000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='5a6d2f2e-da92-49b4-ad5c-71f51e8fe24b' vmin='6' vmaj='1' codename='gLCD_EBM001' x='-28.0001' y='83.9999' z='0.375' xsz='1.6158' ysz='1.4733' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pixel_height' data='160' />
					<value target='pixel_width' data='128' />
					<value target='monochrome' data='0' />
					<value target='foreground_colour' data='0' />
					<value target='background_colour' data='16777215' />
					<value target='colour_bit_depth' data='16' />
					<value target='red_bit_depth' data='5' />
					<value target='green_bit_depth' data='6' />
					<value target='blue_bit_depth' data='5' />
					<value target='data_pin' data='$PORTB.0' />
					<value target='clock_pin' data='$PORTB.1' />
					<value target='chip_sel_pin' data='$PORTB.2' />
					<value target='a0_pin' data='$PORTB.3' />
					<value target='reset_pin' data='$PORTB.4' />
					<value target='led_pin' data='$PORTB.5' />
					<value target='DisplayMethod' data='000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='7fdaec78-394e-4ec9-a578-4f1a12a12076' vmin='1' vmaj='1' codename='led_5mm_clip1' x='-80' y='104' z='-3.85' 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='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pin' data='$PORTB.9' />
					<value target='polarity' data='001' />
					<value target='on_color' data='255' />
					<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>
	</components>
	<keymap />
	<panel2d shadows='0' lighting='0' brightness='0' perspective='0' >
		<background rgb='9737364' img='' style='0' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='0' lighting='0' brightness='0' perspective='0' >
		<background rgb='8398592' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='50' />
		<camera xe='-81.312' ye='76.3656' ze='264.487' xt='-81.312' yt='76.3656' zt='6.175' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel3d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAA9wQAAJEDAAA' zoom='75' scrollx='0' scrolly='449' flags='0' />
		<view type='0' name='Timer_tick' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAA9wQAAJEDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='PlotFFTData' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAA9wQAAJEDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
