<root>
<document scada='0' schema='102' license='1,mnfisher,5YZWG2' title='' description='' fcversion='524802' target='PIC.16F.16LF15313' >
	<config data='!0,3f8c!10,3ffe!20,3f9f!30,1fff!40,3fff%0,4%4,0%8,1%b,1%d,1%10,0%11,1%15,1%16,3%19,1%1a,1%1b,1%1c,1%1d,1%20,1f%25,0%28,7%2b,7%30,1%33,1%34,1%37,1%38,1%39,1%3b,1%3d,0%40,1' clkspd='32000000' simspd='1' usewdt='1' constif='0' commport='3' 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='0' />
			<data name='ClockPin' value='1' />
			<data name='DataPort' value='0' />
			<data name='DataPin' value='0' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='6' />
			<data name='CalculatedCommsDelay' value='6' />
			<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='0db0ee41-b357-4dfa-90bf-6a7fc96bbbfc' 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 >
				<property name='Button1' target='button1' typeid='5' hidden='0' locked='0' info='' />
				<property name='Button2' target='button2' typeid='5' hidden='0' locked='0' info='' />
				<property name='Button3' target='button3' typeid='5' hidden='0' locked='0' info='' />
			</properties>
			<values >
				<value target='button1' data='$PORTA.0' />
				<value target='button2' data='$PORTA.1' />
				<value target='button3' data='$PORTA.2' />
			</values>
			<events />
			<apis />
			<variables >
				<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='BTN3' type='s16' description='' isconst='1' isinit='1' usrinit='2' setinit='2' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='BTN2' type='s16' description='' isconst='1' isinit='1' usrinit='1' setinit='1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='BTN1' type='s16' description='' isconst='1' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='FOLDER' type='s16' description='Folder holding the sounds' isconst='1' isinit='1' usrinit='4' setinit='4' />
				</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='Main' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<local name='button' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='button_pressed' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='current' type='u8' description='' isconst='0' isinit='1' usrinit='&quot;&quot;' setinit='{0,0,0}' >
							<array size='3' />
						</local>
						<local name='FirstTrack' type='u8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='3' />
						</local>
						<local name='NumTracks' type='u8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='3' />
						</local>
						<command class_type='call' title='Init ' cmdcolor='1879295' cmdcolor_sec='5751039' component='DFPlayer' macro='Initiialise' />
						<command class_type='call' title='Set volume to suit' cmdcolor='1879295' cmdcolor_sec='5751039' component='DFPlayer' macro='Volume' >
							<argument exp='22' />
						</command>
						<command class_type='calculation' title='Initialise first and number of tracks' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.FirstTrack[BTN1] = 1' />
							<exp exp='.FirstTrack[BTN2] = 3' />
							<exp exp='.FirstTrack[BTN3] = 5' />
							<exp exp='' />
							<exp exp='.NumTracks[BTN1] = 2' />
							<exp exp='.NumTracks[BTN2] = 2' />
							<exp exp='.NumTracks[BTN3] = 1' />
						</command>
						<command class_type='calculation' title='Clear current track playing ' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.current[BTN1] = 0' />
							<exp exp='.current[BTN2] = 0' />
							<exp exp='.current[BTN3] = 0' />
						</command>
						<command class_type='loop' title='Forever' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='1' >
							<flowline >
								<command class_type='calculation' title='Check if multiple buttons pressed and get number of button press' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='.button_pressed = (button1 == 0) + (button2 == 0) + (button3 == 0)' />
									<exp exp='.button = (button1 == 0) + ((button2 == 0) * 2) + ((button3 == 0) * 3)' />
								</command>
								<command class_type='decision' title='Only one button pressed' cmdcolor='12615680' cmdcolor_sec='15376912' exp='.button_pressed = 1' swap='0' >
									<flowline >
										<command class_type='calculation' title='Adjust for array indexing' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='.button = .button - 1' />
										</command>
										<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='.button &lt; 2' swap='0' >
											<flowline >
												<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='DFPlayer' macro='PlayFolder' >
													<argument exp='FOLDER' />
													<argument exp='.FirstTrack[.button] + .current[.button]' />
												</command>
											</flowline>
											<flowline >
												<command class_type='comment' title='' comment='Remove decision if button 3 is only to play and then stop and 
not interrupt the currently playing sound... Just PlayFolder - 
advert only works if something is playing.' textarea='12,0,12,0' cmdcolor='10944511' cmdcolor_sec='11465458' />
												<command class_type='decision' title='Only play interrupt sound if something is playing' cmdcolor='12615680' cmdcolor_sec='15376912' exp='DFPlayer :: Busy ()' swap='0' >
													<flowline >
														<command class_type='call' title='Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='DFPlayer' macro='Advert' >
															<argument exp='.FirstTrack[.button] + .current[.button]' />
														</command>
													</flowline>
													<flowline >
														<command class_type='call' title='Interrupt sound must have same id in advert and folder FOLDER' cmdcolor='1879295' cmdcolor_sec='5751039' component='DFPlayer' macro='PlayFolder' >
															<argument exp='FOLDER' />
															<argument exp='.FirstTrack[.button] + .current[.button]' />
														</command>
													</flowline>
												</command>
											</flowline>
										</command>
										<command class_type='calculation' title='Advance to next track for button if appropriate' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='.current[.button] = (.current[.button] + 1) % .NumTracks[.button]' />
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='delay' title='To stop key repeating too quickly,,,' cmdcolor='12632064' cmdcolor_sec='16769676' exp='100' type='1' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='62e877e3-e793-4579-a2f5-4fa87cd2a7f8' vmin='0' vmaj='1' codename='DFPlayer' x='0' y='0' z='0' 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='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='34.2268' ye='126.046' ze='29.5949' xt='34.2268' yt='126.046' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='0' lighting='2' brightness='0' perspective='1' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='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' />
	</panel3d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAADgUAAFICAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
