<root>
<document schema='101' license='1,Martin Whitlock,A8EMUQ' title='' description='' target='PIC.16F.16F1937' >
	<config data='!0,fe2!10,1633%0,2%3,0%5,1%6,1%7,1%8,1%9,3%b,1%c,0%d,0%10,3%14,3%18,0%19,1%1a,1%1c,1%1d,0' clkspd='19660800' 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='2' />
			<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='white' />
		<watch expr='red' />
		<watch expr='green' />
		<watch expr='blue' />
		<watch expr='SHapeRed' />
		<watch expr='ManualMode' />
		<watch expr='ReadSW' />
		<watch expr='SwitchCount' />
		<watch expr='ChangeStage' />
		<watch expr='Seconds' />
		<watch expr='SecondsSampleTime' />
		<watch expr='Stage' />
		<watch expr='SwitchCount' />
		<watch expr='TimerTick' />
		<watch expr='Update' />
	</debug>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='5fb97bc8-6f16-410a-af27-b927e3c560ff' 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='ShapeBlue' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='red' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='SwitchCount' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='ShapeGreen' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='blue' 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='SecondsSampleTime' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='green' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='ReadSW' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TimerTick' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Stage' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='ManualMode' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='ChangeStage' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Seconds' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='ShapeRed' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='white' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Update' type='b1' 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>
			</variables>
			<macros >
				<macro >
					<flowline name='DispalyColours' description='' >
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Clear' />
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
							<argument exp='&quot; R:&quot;' />
						</command>
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintNumber' >
							<argument exp='red' />
						</command>
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
							<argument exp='&quot; G:&quot;' />
						</command>
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintNumber' >
							<argument exp='green' />
						</command>
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Cursor' >
							<argument exp='0' />
							<argument exp='1' />
						</command>
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
							<argument exp='&quot;  B:&quot;' />
						</command>
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintNumber' >
							<argument exp='blue' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='TimerINT' description='' >
						<command class_type='calculation' title='Calculation' >
							<exp exp='TimerTick = TimerTick + 1' />
						</command>
						<command class_type='decision' title='Decision' exp='TimerTick = 75' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='Update = 1' />
									<exp exp='TimerTick = 0' />
								</command>
								<command class_type='decision' title='Decision' exp='Seconds &gt; 0' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' >
											<exp exp='Seconds = Seconds - 1' />
										</command>
									</flowline>
									<flowline />
								</command>
							</flowline>
							<flowline />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='SwichPressDetected' description='' >
						<command class_type='calculation' title='Calculation' >
							<exp exp='SwitchCount = 0' />
						</command>
						<command class_type='loop' title='Loop' type='1' exp='(ReadSW = 0) || (SwitchCount &gt; 25)' start='0' >
							<flowline >
								<command class_type='delay' title='Delay' exp='50' type='1' />
								<command class_type='input' title='Input' mode='1' port='1048576' mask='32' exp='ReadSW' />
								<command class_type='calculation' title='Calculation' >
									<exp exp='SwitchCount = SwitchCount + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='decision' title='Decision' exp='SwitchCount &gt;= 20' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='ManualMode = !ManualMode' />
								</command>
								<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Clear' />
								<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Cursor' >
									<argument exp='1' />
									<argument exp='0' />
								</command>
								<command class_type='decision' title='Decision' exp='ManualMode' swap='0' >
									<flowline >
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
											<argument exp='&quot;Manual Mode   &quot;' />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Cursor' >
											<argument exp='0' />
											<argument exp='1' />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
											<argument exp='&quot;Prs sw to sample&quot;' />
										</command>
										<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='SetLEDOff' />
									</flowline>
									<flowline >
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
											<argument exp='&quot;Automatic Mode&quot;' />
										</command>
									</flowline>
								</command>
								<command class_type='delay' title='Delay' exp='2' type='2' />
								<command class_type='calculation' title='Calculation' >
									<exp exp='Stage = 6' />
								</command>
							</flowline>
							<flowline />
						</command>
						<command class_type='loop' title='Loop' type='0' exp='ReadSW = 1' start='0' >
							<flowline >
								<command class_type='input' title='Input' mode='1' port='1048576' mask='32' exp='ReadSW' />
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='Sample program using the EBM018 - Colour sensor

Sets filter to RGB and W and reads values,displays on LCD' >
						<command class_type='comment' title='' comment='The colour sense component works by illuminating the LEDs,
setting the internal filter of the sense chip and detecting the level
of Red, Green, Blue or White in the object.

In simulation, only RGB values can be measured.' textarea='12,0,12,0' />
						<command class_type='comment' title='' comment='During simulation, delays allow for observance of RGB measurements.

In hardware, remove ALL delays from this example.

Hold a colour directly above the sensor. If a red object is placed on 
the sensor, it should return a high value of integer.' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='SecondsSampleTime = 8' />
						</command>
						<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='Initialise' />
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Start' />
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Cursor' >
							<argument exp='1' />
							<argument exp='0' />
						</command>
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
							<argument exp='&quot;Automatic Mode&quot;' />
						</command>
						<command class_type='interrupt' title='Interrupt' enable='1' name='TMR1' call='TimerINT' >
							<settings timer='1' prescale='1' postscale='-1' rollover='-1' bitcount='-1' trigger='3' maskhi='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
								<option value='1' />
								<option value='0' />
								<option value='-1' />
								<option value='-1' />
							</settings>
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='Seconds = SecondsSampleTime' />
							<exp exp='TimerTick = 0' />
							<exp exp='Stage = 1' />
							<exp exp='ChangeStage = 1' />
							<exp exp='Update = 1' />
						</command>
						<command class_type='delay' title='Delay' exp='2' type='2' />
						<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Clear' />
						<command class_type='loop' title='Loop' type='0' exp='1' >
							<flowline >
								<command class_type='decision' title='Decision' exp='Update' swap='0' >
									<flowline >
										<command class_type='decision' title='Decision' exp='(Seconds MOD (SecondsSampleTime &gt;&gt; 2) = 0) &amp;&amp; (ChangeStage = 0)' swap='0' >
											<flowline >
												<command class_type='calculation' title='Calculation' >
													<exp exp='ChangeStage = 1' />
													<exp exp='Stage = Stage + 1' />
												</command>
											</flowline>
											<flowline />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Cursor' >
											<argument exp='1' />
											<argument exp='0' />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
											<argument exp='&quot;Sampling....&quot;' />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Cursor' >
											<argument exp='1' />
											<argument exp='1' />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
											<argument exp='&quot;Seconds:&quot;' />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintNumber' >
											<argument exp='Seconds' />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintString' >
											<argument exp='&quot; Of &quot;' />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='PrintNumber' >
											<argument exp='SecondsSampleTime' />
										</command>
										<command class_type='calculation' title='Calculation' >
											<exp exp='Update = 0' />
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='input' title='Input' mode='1' port='1048576' mask='32' exp='ReadSW' />
								<command class_type='decision' title='Decision' exp='ReadSW' swap='0' >
									<flowline >
										<command class_type='call' title='Call Macro' macro='SwichPressDetected' />
									</flowline>
									<flowline />
								</command>
								<command class_type='decision' title='Decision' exp='ChangeStage' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' >
											<exp exp='ChangeStage = 0' />
										</command>
										<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='Stage' >
											<case >
												<flowline />
											</case>
											<case exp='1' >
												<flowline >
													<command class_type='calculation' title='Create random values for RGB ' >
														<exp exp='ShapeRed = random ()' />
														<exp exp='ShapeGreen = random ()' />
														<exp exp='ShapeBlue = random ()' />
													</command>
													<command class_type='sim' title='Assign random values to shape' macro='Component.Property.SetColor' >
														<argument exp='shape12' />
														<argument exp='ShapeRed' />
														<argument exp='ShapeGreen' />
														<argument exp='ShapeBlue' />
													</command>
													<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='SetLEDOn' />
												</flowline>
											</case>
											<case exp='2' >
												<flowline >
													<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='SetFilter' >
														<argument exp='0' />
													</command>
													<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='GetFrequency' >
														<return exp='red' />
													</command>
												</flowline>
											</case>
											<case exp='3' >
												<flowline >
													<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='SetFilter' >
														<argument exp='1' />
													</command>
													<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='GetFrequency' >
														<return exp='green' />
													</command>
												</flowline>
											</case>
											<case exp='4' >
												<flowline >
													<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='SetFilter' >
														<argument exp='2' />
													</command>
													<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='GetFrequency' >
														<return exp='blue' />
													</command>
												</flowline>
											</case>
											<case exp='5' >
												<flowline >
													<command class_type='call' title='Call Component Macro' component='EBM018_ColourSensor1' macro='SetLEDOff' />
													<command class_type='call' title='Call Macro' macro='DispalyColours' />
													<command class_type='calculation' title='Calculation' >
														<exp exp='Stage = 6' />
													</command>
												</flowline>
											</case>
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='decision' title='Decision' exp='Stage = 6' swap='0' >
									<flowline >
										<command class_type='decision' title='Decision' exp='ManualMode' swap='0' >
											<flowline >
												<command class_type='call' title='Call Component Macro' component='pcb_switch1' macro='WaitUntilHigh' />
											</flowline>
											<flowline >
												<command class_type='delay' title='Delay' exp='3' type='2' />
											</flowline>
										</command>
										<command class_type='calculation' title='Calculation' >
											<exp exp='Seconds = SecondsSampleTime' />
											<exp exp='TimerTick = 0' />
											<exp exp='Stage = 1' />
											<exp exp='ChangeStage = 1' />
										</command>
										<command class_type='call' title='Call Component Macro' component='lcd_eb005' macro='Clear' />
									</flowline>
									<flowline />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='d29dda88-17de-4008-991a-c881890d4c57' vmin='1' vmaj='1' codename='lcd_eb005' x='2.10247' y='-41.7389' z='4.42736' 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_0' data='$PORTC.0' />
					<value target='Pin_Data_1' data='$PORTC.1' />
					<value target='Pin_Data_2' data='$PORTC.2' />
					<value target='Pin_Data_3' data='$PORTC.3' />
					<value target='Pin_RS' data='$PORTC.4' />
					<value target='Pin_E' data='$PORTC.5' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='shape' codename='shape12' x='1.45637' y='20.3831' z='33.6319' xsz='32.3292' ysz='32' zsz='32' 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='Shape' data='0' />
					<value target='Color' data='1445393' />
					<value target='Outline' data='0' />
					<value target='Thickness' data='0' />
					<value target='Image' data='' />
					<value target='Model' data='' />
					<value target='Unit' data='' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='749afd05-ce22-42cb-b17e-3f424cbca6b0' vmin='0' vmaj='1' codename='EBM018_ColourSensor1' x='0.160373' y='15.2051' z='3.14338' 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='1' >
				<resources />
				<properties />
				<values >
					<value target='SDA' data='$PORTB.4' />
					<value target='SCL' data='$PORTB.2' />
					<value target='OP' data='$PORTB.5' />
					<value target='FRQ' data='004' />
					<value target='FILTER' data='008' />
					<value target='LED' data='000' />
					<value target='SAMPLE' data='002' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='fc04a65f-f03d-40c8-9f69-0d23d2daac29' vmin='1' vmaj='1' codename='pcb_switch1' x='-32' y='40' z='45.7125' 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='$PORTA.5' />
					<value target='polarity' data='000' />
					<value target='debounce' data='' />
					<value target='operation' data='000' />
					<value target='color' data='6908265' />
				</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='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='1' lighting='2' brightness='0' perspective='0' >
		<background rgb='32768' img='' style='0' />
		<table rgb='8404224' img='' style='0' size='25' />
		<camera xe='12.8208' ye='-121.422' ze='155.227' xt='0.160373' yt='15.2051' zt='3.14338' xquat='-0.358453' yquat='-0.0165723' zquat='-0.0431077' wquat='0.932405' />
	</panel3d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAAUwQAALIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='DispalyColours' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAAUwQAALIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='TimerINT' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAAUwQAALIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='SwichPressDetected' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAAUwQAALIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
