<root>
<document schema='101' license='1,Zane Liddle,8KB0G6' title='' description='' target='PIC16.30F.30F4011' >
	<config data='!0,8712!10,3f!20,7a3!30,310f!40,330f!50,3!60,c003%0,2%8,3%e,2%10,f%14,3%1f,0%20,3%24,2%27,1%28,1%29,1%2a,1%2f,0%30,f%38,1%3c,3%40,f%48,3%4c,3%50,1%51,1%52,0%60,3%6e,1%6f,1' 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='0' />
			<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='0' />
			<data name='ictrate' value='20000' />
			<data name='ictmask' value='0' />
			<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='DisplayImage.FileName' />
		<watch expr='StringLength' />
		<watch expr='LoopCount' />
		<watch expr='HandleHigh' />
		<watch expr='HandleLow' />
		<watch expr='OffsetHighMSB' />
		<watch expr='ForegroundColour' />
		<watch expr='ForegroundColourMSB' />
		<watch expr='ForegroundColourLSB' />
		<watch expr='BackgroundColourMSB' />
		<watch expr='BackgroundColourLSB' />
		<watch expr='BackgroundColour' />
		<watch expr='BackgroundColour' />
		<watch expr='ForegroundBlue' />
		<watch expr='ForegroundRed' />
		<watch expr='ForegroundColour' />
	</debug>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='2cd35859-eac7-4195-b462-80195c453d73' vstate='40' vmin='0' vmaj='1' srcleaf='Component4D_R44Picaso.fcfx' visiblename='Picaso4D_V2' description='' category='Misc' catenable='1' author='' manuname='' manucode='' sysinfo='1053483' keywords='' dynamic='0' iconpath='' />
		<component class_type='root' codename='Picaso4D_V2' 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 >
				<property name='Connections' folder='property_1' hidden='0' >
					<property name='Channel' target='CHANNEL' typeid='16' hidden='0' locked='0' info='' filter='000Software
001Channel 1
002Channel 2
' />
					<property name='BAUD_RATE' target='BAUD_RATE' typeid='16' hidden='0' locked='0' info='' filter='000Custom
0011200
0022400
0034800
0049600
00519200
00631250
00738400
00857600
009115200' />
					<property name='TX' target='TX' typeid='5' hidden='0' locked='1' info='' />
					<property name='RX' target='RX' typeid='5' hidden='0' locked='1' info='' />
					<property name='RESET_PIN' target='RESET_PIN' typeid='5' hidden='0' locked='0' info='' />
					<property name='Highspeed' target='Highspeed' typeid='7' hidden='0' locked='0' info='' />
				</property>
				<property name='Colour' folder='property_2' hidden='0' >
					<property name='Foreground' target='FOREGROUND' typeid='1' hidden='0' locked='0' info='' />
					<property name='Background' target='BACKGROUND' typeid='1' hidden='0' locked='0' info='' />
				</property>
			</properties>
			<values >
				<value target='CHANNEL' data='001' />
				<value target='BAUD_RATE' data='004' />
				<value target='TX' data='$PORTF.3' />
				<value target='RX' data='$PORTF.2' />
				<value target='RESET_PIN' data='$PORTF.6' />
				<value target='Highspeed' data='1' />
				<value target='FOREGROUND' data='65280' />
				<value target='BACKGROUND' data='0' />
			</values>
			<events >
				<event class='Components' event='Property' target='Ev_Property' />
			</events>
			<apis >
				<api name='DisplayImage' alt='DisplayImage' type='1' proto='1' />
				<api name='InitialiseSDCard' alt='InitialiseSDCard' type='1' proto='1' />
				<api name='ClearDisplay' alt='ClearDisplay' type='1' proto='1' />
				<api name='InitialiseDisplay' alt='InitialiseDisplay' type='1' proto='1' />
			</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='true' type='b1' description='' isconst='1' isinit='1' usrinit='1' setinit='1' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='DisplayImage' description='Displays an image from the SD card' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<param name='XPosition' type='u16' description='The X co-ordinate where the image will be placed' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='YPosition' type='u16' description='The Y co-ordinate where the image will be placed' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='FileName' type='T8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='12' />
						</param>
						<param name='OffsetHigh' type='u16' description='The high offset for the image set from graphics composer' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='OffsetLow' type='u16' description='The Low offset for the image set from graphics composer' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='RxData' type='u8' description='Rx Data' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='Buffer' type='u8' description='Buffer' isconst='0' isinit='1' usrinit='&quot;&quot;' setinit='&quot;&quot;' >
							<array size='3' />
						</local>
						<local name='BufferIndex' type='u8' description='BufferPointer' isconst='0' isinit='1' usrinit='1' setinit='1' />
						<local name='StringLength' type='u8' description='Length of the string' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='LoopCount' type='u8' description='The loop count' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='HandleMSB' type='u8' description='The high byte of the handle associated to the file' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='HandleLSB' type='u8' description='The low byte of the handle associated to the file' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='OffsetHighMSB' type='u8' description='The high MSB offset for the image set from graphics composer' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='OffsetHighLSB' type='u8' description='The high LSB offset for the image set from graphics composer' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='OffsetLowMSB' type='u8' description='The low MSB offset for the image set from graphics composer' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='OffsetLowLSB' type='u8' description='The low LSB offset for the image set from graphics composer' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='XPositionMSB' type='u8' description='The high byte of the X co-ordinate where the image will be displayed' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='XPositionLSB' type='u8' description='The low byte of the X co-ordinate where the image will be displayed' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='YPositionMSB' type='u8' description='The high byte of the Y co-ordinate where the image will be displayed' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='YPositionLSB' type='u8' description='The low byte of the Y co-ordinate where the image will be displayed' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='comment' title='' comment='
File open

' textarea='12,0,12,0' />
						<command class_type='comment' title='' comment='Send the command' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0x00' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0x0a' />
						</command>
						<command class_type='comment' title='' comment='Send the file name' textarea='12,0,12,0' />
						<command class_type='calculation' title='Get the length of the string' >
							<exp exp='.StringLength = Length$ (.FileName)' />
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.LoopCount = 0' />
						</command>
						<command class_type='loop' title='Loop until the complete string is sent' type='1' exp='.StringLength = .LoopCount' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
									<argument exp='.FileName[.LoopCount]' />
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.LoopCount = .LoopCount + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='comment' title='' comment='Send a null character to show the end of the file name' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0x00' />
						</command>
						<command class_type='comment' title='' comment='Send a read command' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0x72' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.BufferIndex = 1' />
						</command>
						<command class_type='loop' title='Loop' type='1' exp='.BufferIndex &gt; 3' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
									<return exp='.RxData' />
									<argument exp='255' />
								</command>
								<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='.BufferIndex' >
									<case >
										<flowline />
									</case>
									<case exp='1' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[0] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='2' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[1] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='3' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[2] = .RxData' />
											</command>
										</flowline>
									</case>
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.BufferIndex = .BufferIndex + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.HandleMSB = .Buffer[1]' />
							<exp exp='.HandleLSB = .Buffer[2]' />
						</command>
						<command class_type='comment' title='' comment='
File seek

' textarea='12,0,12,0' />
						<command class_type='comment' title='' comment='Get the high and low bytes for the file offset of the image' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.OffsetHighMSB = ((.OffsetHigh &amp; 0xff00) &gt;&gt; 8)' />
							<exp exp='.OffsetHighLSB = (.OffsetHigh &amp; 0xff)' />
							<exp exp='.OffsetLowMSB = ((.OffsetLow &amp; 0xff00) &gt;&gt; 8)' />
							<exp exp='.OffsetLowLSB = (.OffsetLow &amp; 0xff)' />
						</command>
						<command class_type='comment' title='' comment='Send the command' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xff' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0x16' />
						</command>
						<command class_type='comment' title='' comment='Send the file handle' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.HandleMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.HandleLSB' />
						</command>
						<command class_type='comment' title='' comment='Send the file offset for the image' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.OffsetHighMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.OffsetHighLSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.OffsetLowMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.OffsetLowLSB' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.BufferIndex = 1' />
						</command>
						<command class_type='loop' title='Loop' type='1' exp='.BufferIndex &gt; 3' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
									<return exp='.RxData' />
									<argument exp='255' />
								</command>
								<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='.BufferIndex' >
									<case >
										<flowline />
									</case>
									<case exp='1' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[0] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='2' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[1] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='3' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[2] = .RxData' />
											</command>
										</flowline>
									</case>
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.BufferIndex = .BufferIndex + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='comment' title='' comment='
Display image

' textarea='12,0,12,0' />
						<command class_type='comment' title='' comment='Get the high and low bytes for the co-ordinates of the image' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.XPositionMSB = ((.XPosition &amp; 0xff00) &gt;&gt; 8)' />
							<exp exp='.XPositionLSB = (.XPosition &amp; 0xff)' />
							<exp exp='.YPositionMSB = ((.YPosition &amp; 0xff00) &gt;&gt; 8)' />
							<exp exp='.YPositionLSB = (.YPosition &amp; 0xff)' />
						</command>
						<command class_type='comment' title='' comment='Send the command' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xff' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0x11' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.XPositionMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.XPositionLSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.YPositionMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.YPositionLSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.HandleMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.HandleLSB' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.BufferIndex = 1' />
						</command>
						<command class_type='loop' title='Loop' type='1' exp='.BufferIndex &gt; 3' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
									<return exp='.RxData' />
									<argument exp='255' />
								</command>
								<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='.BufferIndex' >
									<case >
										<flowline />
									</case>
									<case exp='1' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[0] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='2' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[1] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='3' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[2] = .RxData' />
											</command>
										</flowline>
									</case>
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.BufferIndex = .BufferIndex + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='comment' title='' comment='
File Close

' textarea='12,0,12,0' />
						<command class_type='comment' title='' comment='Send the command' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xff' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0x18' />
						</command>
						<command class_type='comment' title='' comment='Send the file handle' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.HandleMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.HandleLSB' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.BufferIndex = 1' />
						</command>
						<command class_type='loop' title='Loop' type='1' exp='.BufferIndex &gt; 3' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
									<return exp='.RxData' />
									<argument exp='255' />
								</command>
								<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='.BufferIndex' >
									<case >
										<flowline />
									</case>
									<case exp='1' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[0] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='2' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[1] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='3' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[2] = .RxData' />
											</command>
										</flowline>
									</case>
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.BufferIndex = .BufferIndex + 1' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Ev_Property' description='Sent when a property has been changed by the User' >
						<return name='Return' type='u32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='TempString' type='T8' description='' isconst='0' isinit='1' usrinit='&quot;&quot;' setinit='&quot;&quot;' >
							<array size='20' />
						</local>
						<command class_type='sim' title='Simulation' component='cal_uart1' macro='GetList' >
							<return exp='.TempString' />
							<argument exp='&quot;CHANNEL&quot;' />
						</command>
						<command class_type='sim' title='Simulation' macro='Component.Property.SetFilter' >
							<argument exp='this' />
							<argument exp='&quot;CHANNEL&quot;' />
							<argument exp='.TempString' />
						</command>
						<command class_type='sim' title='Simulation' macro='Component.Property.GetValue' >
							<return exp='.TempString' />
							<argument exp='this' />
							<argument exp='&quot;CHANNEL&quot;' />
						</command>
						<command class_type='sim' title='Simulation' component='cal_uart1' macro='SetValue' >
							<argument exp='&quot;CHANNEL&quot;' />
							<argument exp='.TempString' />
						</command>
						<command class_type='sim' title='Simulation' component='cal_uart1' macro='GetList' >
							<return exp='.TempString' />
							<argument exp='&quot;BAUD_LIST&quot;' />
						</command>
						<command class_type='sim' title='Simulation' macro='Component.Property.SetFilter' >
							<argument exp='this' />
							<argument exp='&quot;BAUD_RATE&quot;' />
							<argument exp='.TempString' />
						</command>
						<command class_type='sim' title='Simulation' macro='Component.Property.GetValue' >
							<return exp='.TempString' />
							<argument exp='this' />
							<argument exp='&quot;BAUD_RATE&quot;' />
						</command>
						<command class_type='sim' title='Simulation' component='cal_uart1' macro='SetValue' >
							<argument exp='&quot;BAUD_LIST&quot;' />
							<argument exp='.TempString' />
						</command>
						<command class_type='decision' title='Is software mode selected' exp='CHANNEL = 0' swap='0' >
							<flowline >
								<command class_type='sim' title='Simulation' macro='Component.Property.SetWritable' >
									<argument exp='this' />
									<argument exp='&quot;TX&quot;' />
									<argument exp='1' />
								</command>
								<command class_type='sim' title='Simulation' macro='Component.Property.SetWritable' >
									<argument exp='this' />
									<argument exp='&quot;RX&quot;' />
									<argument exp='1' />
								</command>
								<command class_type='sim' title='Simulation' macro='Component.Property.GetValue' >
									<return exp='.TempString' />
									<argument exp='this' />
									<argument exp='&quot;TX&quot;' />
								</command>
								<command class_type='sim' title='Simulation' component='cal_uart1' macro='SetValue' >
									<argument exp='&quot;TX&quot;' />
									<argument exp='.TempString' />
								</command>
								<command class_type='sim' title='Simulation' macro='Component.Property.GetValue' >
									<return exp='.TempString' />
									<argument exp='this' />
									<argument exp='&quot;RX&quot;' />
								</command>
								<command class_type='sim' title='Simulation' component='cal_uart1' macro='SetValue' >
									<argument exp='&quot;RX&quot;' />
									<argument exp='.TempString' />
								</command>
							</flowline>
							<flowline >
								<command class_type='sim' title='Simulation' macro='Component.Property.SetWritable' >
									<argument exp='this' />
									<argument exp='&quot;TX&quot;' />
									<argument exp='0' />
								</command>
								<command class_type='sim' title='Simulation' macro='Component.Property.SetWritable' >
									<argument exp='this' />
									<argument exp='&quot;RX&quot;' />
									<argument exp='0' />
								</command>
								<command class_type='sim' title='Simulation' component='cal_uart1' macro='GetValue' >
									<return exp='.TempString' />
									<argument exp='&quot;TX&quot;' />
								</command>
								<command class_type='sim' title='Simulation' macro='Component.Property.SetValue' >
									<argument exp='this' />
									<argument exp='&quot;TX&quot;' />
									<argument exp='.TempString' />
								</command>
								<command class_type='sim' title='Simulation' component='cal_uart1' macro='GetValue' >
									<return exp='.TempString' />
									<argument exp='&quot;RX&quot;' />
								</command>
								<command class_type='sim' title='Simulation' macro='Component.Property.SetValue' >
									<argument exp='this' />
									<argument exp='&quot;RX&quot;' />
									<argument exp='.TempString' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='InitialiseSDCard' description='Initialises the SD card so it can be read' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<local name='Buffer' type='u8' description='Buffer' isconst='0' isinit='1' usrinit='&quot;&quot;' setinit='&quot;&quot;' >
							<array size='3' />
						</local>
						<local name='BufferIndex' type='u8' description='Buffer pointer' isconst='0' isinit='1' usrinit='1' setinit='1' />
						<local name='RxData' type='u8' description='Rx Data' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='comment' title='' comment='File mount' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xff' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0x03' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.BufferIndex = 1' />
						</command>
						<command class_type='loop' title='Loop' type='1' exp='.BufferIndex &gt; 3' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
									<return exp='.RxData' />
									<argument exp='255' />
								</command>
								<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='.BufferIndex' >
									<case >
										<flowline />
									</case>
									<case exp='1' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[0] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='2' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[1] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='3' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[2] = .RxData' />
											</command>
										</flowline>
									</case>
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.BufferIndex = .BufferIndex + 1' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='ClearDisplay' description='Clears the screen' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<local name='RxData' type='u8' description='Rx Data' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='comment' title='' comment='Clear screen' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xff' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xcd' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
							<return exp='.RxData' />
							<argument exp='255' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='InitialiseDisplay' description='Initialises the display setting the baud rate, the foreground and background colours' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<local name='RxData' type='u8' description='Rx Data' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='Buffer' type='u8' description='Buffer' isconst='0' isinit='1' usrinit='&quot;&quot;' setinit='&quot;&quot;' >
							<array size='3' />
						</local>
						<local name='BufferIndex' type='u8' description='Buffer pointer' isconst='0' isinit='1' usrinit='1' setinit='1' />
						<local name='ForegroundRed' type='u32' description='The red component of the foreground colour' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='ForegroundGreen' type='u32' description='The green component of the foreground colour' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='ForegroundBlue' type='u32' description='The blue component of the foreground colour' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='BackgroundRed' type='u32' description='The red component of the background colour' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='BackgroundGreen' type='u32' description='The green component of the background colour' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='BackgroundBlue' type='u32' description='The blue component of the background colour' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='BackgroundColour' type='u16' description='The colour of the background with all colour components added together' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='ForegroundColour' type='u16' description='The colour of the foreground with all colour components added together' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='ForegroundColourMSB' type='u8' description='The colour of the foreground with all colour components added together MSB' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='ForegroundColourLSB' type='u8' description='The colour of the foreground with all colour components added together LSB' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='BackgroundColourMSB' type='u8' description='The colour of the background with all colour components added together MSB' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='BackgroundColourLSB' type='u8' description='The colour of the background with all colour components added together LSB' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='comment' title='' comment='All uart reads are set with an infinite wait time (255) so no more data is
sent to the display until it has sent a response showing it has processed
the previous instruction.' textarea='12,0,12,0' />
						<command class_type='delay' title='Wait for the display to start up' exp='2' type='2' />
						<command class_type='comment' title='' comment='
Set the baud rate

' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Init' />
						<command class_type='decision' title='Is the high baud rate required' exp='Highspeed = 1' swap='0' >
							<flowline >
								<command class_type='comment' title='' comment='Set high baud rate' textarea='12,0,12,0' />
								<command class_type='comment' title='' comment='Send the command' textarea='12,0,12,0' />
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
									<argument exp='0x0' />
								</command>
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
									<argument exp='0x26' />
								</command>
								<command class_type='comment' title='' comment='Send the baud rate' textarea='12,0,12,0' />
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
									<argument exp='0x0' />
								</command>
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
									<argument exp='0x0a' />
								</command>
								<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
									<return exp='.RxData' />
									<argument exp='255' />
								</command>
								<command class_type='comment' title='' comment='Update the hosts baud rate' textarea='12,0,12,0' />
								<command class_type='comment' title='' comment='If the baud rate is set higher than 38400
the outgoing data has errors in it???' textarea='12,0,12,0' />
								<command class_type='call' title='Update the baud rate to 38400' component='cal_uart1' macro='UpdateBaud' >
									<argument exp='5' />
								</command>
							</flowline>
							<flowline >
								<command class_type='comment' title='' comment='Leave baud rate at 9600' textarea='12,0,12,0' />
							</flowline>
						</command>
						<command class_type='calculation' title='Convert the foreground colour' >
							<exp exp='.ForegroundBlue = (((FOREGROUND &amp; 0xff0000) &gt;&gt; 16) / 8)' />
							<exp exp='.ForegroundGreen = (((FOREGROUND &amp; 0xff00) &gt;&gt; 8) / 4)' />
							<exp exp='.ForegroundGreen = .ForegroundGreen &lt;&lt; 5' />
							<exp exp='.ForegroundRed = ((FOREGROUND &amp; 0xff) / 8)' />
							<exp exp='.ForegroundRed = .ForegroundRed &lt;&lt; 11' />
							<exp exp='.ForegroundColour = (.ForegroundColour | .ForegroundRed) + (.ForegroundColour | .ForegroundGreen) + (.ForegroundColour | .ForegroundBlue)' />
							<exp exp='.ForegroundColourMSB = (.ForegroundColour &amp; 0xff00) &gt;&gt; 8' />
							<exp exp='.ForegroundColourLSB = (.ForegroundColour &amp; 0xff)' />
						</command>
						<command class_type='calculation' title='Convert the background colour' >
							<exp exp='.BackgroundBlue = (((BACKGROUND &amp; 0xff0000) &gt;&gt; 16) / 8)' />
							<exp exp='.BackgroundGreen = (((BACKGROUND &amp; 0xff00) &gt;&gt; 8) / 4)' />
							<exp exp='.BackgroundGreen = .BackgroundGreen &lt;&lt; 5' />
							<exp exp='.BackgroundRed = ((BACKGROUND &amp; 0xff) / 8)' />
							<exp exp='.BackgroundRed = .BackgroundRed &lt;&lt; 11' />
							<exp exp='.BackgroundColour = (.BackgroundColour | .BackgroundRed) + (.BackgroundColour | .BackgroundGreen) + (.BackgroundColour | .BackgroundBlue)' />
							<exp exp='.BackgroundColourMSB = (.BackgroundColour &amp; 0xff00) &gt;&gt; 8' />
							<exp exp='.BackgroundColourLSB = (.BackgroundColour &amp; 0xff)' />
						</command>
						<command class_type='comment' title='' comment='
Set the background colour of the screen

' textarea='12,0,12,0' />
						<command class_type='comment' title='' comment='Send the command' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xff' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xa4' />
						</command>
						<command class_type='comment' title='' comment='Send the colour' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.BackgroundColourMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.BackgroundColourLSB' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.BufferIndex = 1' />
						</command>
						<command class_type='loop' title='Loop' type='1' exp='.BufferIndex &gt; 3' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
									<return exp='.RxData' />
									<argument exp='255' />
								</command>
								<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='.BufferIndex' >
									<case >
										<flowline />
									</case>
									<case exp='1' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[0] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='2' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[1] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='3' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[2] = .RxData' />
											</command>
										</flowline>
									</case>
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.BufferIndex = .BufferIndex + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='comment' title='' comment='
Set the background colour of the text

' textarea='12,0,12,0' />
						<command class_type='comment' title='' comment='Send the command' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xff' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xe6' />
						</command>
						<command class_type='comment' title='' comment='Send the colour' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.BackgroundColourMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.BackgroundColourLSB' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.BufferIndex = 1' />
						</command>
						<command class_type='loop' title='Loop' type='1' exp='.BufferIndex &gt; 3' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
									<return exp='.RxData' />
									<argument exp='255' />
								</command>
								<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='.BufferIndex' >
									<case >
										<flowline />
									</case>
									<case exp='1' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[0] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='2' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[1] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='3' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[2] = .RxData' />
											</command>
										</flowline>
									</case>
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.BufferIndex = .BufferIndex + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='comment' title='' comment='
Set the foreground colour of the text

' textarea='12,0,12,0' />
						<command class_type='comment' title='' comment='Send the command' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xff' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xe7' />
						</command>
						<command class_type='comment' title='' comment='Send the colour' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.ForegroundColourMSB' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='.ForegroundColourLSB' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.BufferIndex = 1' />
						</command>
						<command class_type='loop' title='Loop' type='1' exp='.BufferIndex &gt; 3' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
									<return exp='.RxData' />
									<argument exp='255' />
								</command>
								<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='.BufferIndex' >
									<case >
										<flowline />
									</case>
									<case exp='1' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[0] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='2' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[1] = .RxData' />
											</command>
										</flowline>
									</case>
									<case exp='3' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Buffer[2] = .RxData' />
											</command>
										</flowline>
									</case>
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.BufferIndex = .BufferIndex + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='comment' title='' comment='
Clear the screen to update the colours on the screen

' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xff' />
						</command>
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Send' >
							<argument exp='0xcd' />
						</command>
						<command class_type='comment' title='' comment='Wait for the ackowledge from the display' textarea='12,0,12,0' />
						<command class_type='call' title='Call Component Macro' component='cal_uart1' macro='Receive' >
							<return exp='.RxData' />
							<argument exp='255' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='91b64b1d-b8b2-40f1-b073-e953a91fa234' vmin='1' vmaj='1' codename='cal_uart1' x='0' y='80' 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='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='CHANNEL' data='001' />
					<value target='TX' data='$PORTF.3' />
					<value target='OutputPins' data='007' />
					<value target='RX' data='$PORTF.2' />
					<value target='InputPins' data='013' />
					<value target='CTS_PORT' data='$PORTE.1' />
					<value target='CTS_PIN' data='1' />
					<value target='CTS_TRIS' data='$PORTE.1' />
					<value target='RTS_PORT' data='$PORTE.0' />
					<value target='RTS_PIN' data='0' />
					<value target='RTS_TRIS' data='$PORTE.0' />
					<value target='BAUD_LIST' data='004' />
					<value target='BAUD' data='9600' />
					<value target='DBITS' data='008' />
					<value target='RETURN' data='000' />
					<value target='ECHO' data='000' />
					<value target='INT' data='000' />
					<value target='FLOWEN' data='000' />
					<value target='RTS' data='$PORTE.0' />
					<value target='CTS' data='$PORTE.1' />
					<value target='REF' data='0' />
					<value target='TX_PORT' data='$PORTF.3' />
					<value target='TX_TRIS' data='$PORTF.3' />
					<value target='TX_PIN' data='3' />
					<value target='RX_PORT' data='$PORTF.2' />
					<value target='RX_TRIS' data='$PORTF.2' />
					<value target='RX_PIN' data='2' />
					<value target='REMAPPABLE' data='' />
					<value target='OutputReg' data='007' />
					<value target='TXRPNUM' data='3' />
					<value target='RXRPREG' data='RPINR18bits.U1RXR' />
					<value target='Injector' data='000' />
					<value target='InjectorHandle' data='0' />
					<value target='ScopeTraces' data='0' />
					<value target='ConsoleData' data='0' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='shape' codename='shape1' x='0' y='0' z='0' xsz='32' 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='101' />
					<value target='Color' data='2960685' />
					<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='text' codename='label3' x='0' y='-6' z='0.25' xsz='7.77536' ysz='13' zsz='0' 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='Color' data='255' />
					<value target='Background' data='-1' />
					<value target='Font' data='Arial Rounded MT Bold' />
					<value target='Text' data='DISPLAY' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='text' codename='label1' x='0' y='6' z='0.25' xsz='7.77536' ysz='13' zsz='0' 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='Color' data='255' />
					<value target='Background' data='-1' />
					<value target='Font' data='Arial Rounded MT Bold' />
					<value target='Text' data='4D V2' />
				</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='0' lighting='2' brightness='0' perspective='0' >
		<background rgb='16760832' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='25' />
		<camera xe='0' ye='0' ze='36.2621' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel3d>
	<layout >
		<view type='0' name='Ev_Property' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAARAIAAJkCAAA' zoom='25' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAARAIAAJkCAAA' zoom='25' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='InitialiseSDCard' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAARAIAAJkCAAA' zoom='25' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='InitialiseDisplay' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAARAIAAJkCAAA' zoom='25' scrollx='0' scrolly='1961' flags='0' />
		<view type='0' name='DisplayImage' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAARAIAAJkCAAA' zoom='25' scrollx='0' scrolly='672' flags='0' />
		<view type='0' name='ClearDisplay' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAARAIAAJkCAAA' zoom='25' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
