<root>
<document schema='101' license='1,30day_15266180,GCF0W0' title='' description='' target='PIC.18F.ECIO-40' >
	<config data='' clkspd='48000000' simspd='2' 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 />
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='4ca00792-4df3-42f9-a41e-9fe0e2870e9b' 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='false' type='b1' description='' isconst='1' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Global_Bright' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='LEDData' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' >
						<array size='8' />
						<array size='3' />
					</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='FuncSetLEDGeneral' description='' >
						<param name='LedMax' type='u8' description='Number of LEDs to cycle Through' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='OldStatus' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='LedID' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='loop' title='Send 32 &apos;0&apos; Bits for StartFrame' type='2' exp='4' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='SPI_Master1' macro='SendChar' >
									<argument exp='0x00' />
								</command>
							</flowline>
						</command>
						<command class_type='calculation' title='Reset LED ID Value' >
							<exp exp='.LedID = 0' />
							<exp exp='' />
						</command>
						<command class_type='comment' title='' comment='the LED data &apos;frames&apos; need;
The 8 bit start byte, this includes the global brightness value.
The 8 bit BLUE byte.
The 8 bit GREEN byte.
The 8 bit RED byte.
So 32 bits in total per LED. 
The loop cycles around until it has sent data for all LEDs and reaches the value LedMax.
' textarea='12,0,12,0' />
						<command class_type='loop' title='Send LED Frames' type='1' exp='.LedMax == .LedID' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='SPI_Master1' macro='SendChar' >
									<argument exp='Global_Bright' />
								</command>
								<command class_type='call' title='Send BLUE Value' component='SPI_Master1' macro='SendChar' >
									<argument exp='LEDData[.LedID][0]' />
								</command>
								<command class_type='call' title='Send GREEN Value' component='SPI_Master1' macro='SendChar' >
									<argument exp='LEDData[.LedID][1]' />
								</command>
								<command class_type='call' title='Send RED Value' component='SPI_Master1' macro='SendChar' >
									<argument exp='LEDData[.LedID][2]' />
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.LedID = .LedID + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='loop' title='Send END Frame' type='2' exp='4' >
							<flowline >
								<command class_type='call' title='Call Component Macro' component='SPI_Master1' macro='SendChar' >
									<argument exp='0x00' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' >
						<command class_type='comment' title='' comment='Example uses Matrix ECIO40P (PIC18F4455) and uses the hardware SPI.' textarea='12,0,12,0' />
						<command class_type='comment' title='' comment='This is very simple example just for testing the hardware.' textarea='12,0,12,0' />
						<command class_type='calculation' title='Setup Values' >
							<exp exp='Global_Bright = 0b11111000 // Only lower 5 bits adjust brightness' />
							<exp exp='//xxx00001 = Lowest Global Setting' />
							<exp exp='//xxx11111 = Highest Global Setting' />
						</command>
						<command class_type='call' title='Call Component Macro' component='SPI_Master1' macro='Initialise' />
						<command class_type='loop' title='Loop' type='0' exp='1' >
							<flowline >
								<command class_type='calculation' title='HardCoded Required LED Colours' textarea='36,0,36,449' >
									<exp exp='// LED brightness responce is non-linear.' />
									<exp exp='// Values of 1,2,4,8,16,32,64,128,255 are my basic starting brightness steps.' />
									<exp exp='// A value of 128 to 180 gives practically full brightness but without excessive curent draw.' />
									<exp exp='//LED 0' />
									<exp exp='LEDData[0][0] = 0 //BLU' />
									<exp exp='LEDData[0][1] = 0 //GRN' />
									<exp exp='LEDData[0][2] = 128 //RED' />
									<exp exp='//LED 1' />
									<exp exp='LEDData[1][0] = 0 //BLU' />
									<exp exp='LEDData[1][1] = 128 //GRN' />
									<exp exp='LEDData[1][2] = 0 //RED' />
									<exp exp='//LED 2' />
									<exp exp='LEDData[2][0] = 128 //BLU' />
									<exp exp='LEDData[2][1] = 0 //GRN' />
									<exp exp='LEDData[2][2] = 0 //RED' />
									<exp exp='//LED 3' />
									<exp exp='LEDData[3][0] = 64 //BLU' />
									<exp exp='LEDData[3][1] = 64 //GRN' />
									<exp exp='LEDData[3][2] = 64 //RED' />
									<exp exp='//LED 4' />
									<exp exp='LEDData[4][0] = 64 //BLU' />
									<exp exp='LEDData[4][1] = 0 //GRN' />
									<exp exp='LEDData[4][2] = 0 //RED' />
									<exp exp='//LED 5' />
									<exp exp='LEDData[5][0] = 16 //BLU' />
									<exp exp='LEDData[5][1] = 0 //GRN' />
									<exp exp='LEDData[5][2] = 0 //RED' />
									<exp exp='//LED 6' />
									<exp exp='LEDData[6][0] = 4 //BLU' />
									<exp exp='LEDData[6][1] = 0 //GRN' />
									<exp exp='LEDData[6][2] = 0 //RED' />
									<exp exp='//LED 7' />
									<exp exp='LEDData[7][0] = 0 //BLU' />
									<exp exp='LEDData[7][1] = 16 //GRN' />
									<exp exp='LEDData[7][2] = 16 //RED' />
								</command>
								<command class_type='call' title='Call Macro' macro='FuncSetLEDGeneral' >
									<argument exp='8' />
								</command>
								<command class_type='delay' title='Delay' exp='500' type='1' />
								<command class_type='calculation' title='HardCoded Required LED Colours' textarea='36,0,36,449' >
									<exp exp='// LED brightness responce is non-linear.' />
									<exp exp='// Values of 1,2,4,8,16,32,64,128,255 are my basic starting brightness steps.' />
									<exp exp='// A value of 128 to 180 gives practically full brightness but without excessive curent draw.' />
									<exp exp='//LED 0' />
									<exp exp='LEDData[0][0] = 128 //BLU' />
									<exp exp='LEDData[0][1] = 0 //GRN' />
									<exp exp='LEDData[0][2] = 0 //RED' />
									<exp exp='//LED 1' />
									<exp exp='LEDData[1][0] = 128 //BLU' />
									<exp exp='LEDData[1][1] = 0 //GRN' />
									<exp exp='LEDData[1][2] = 0 //RED' />
									<exp exp='//LED 2' />
									<exp exp='LEDData[2][0] = 128 //BLU' />
									<exp exp='LEDData[2][1] = 0 //GRN' />
									<exp exp='LEDData[2][2] = 0 //RED' />
									<exp exp='//LED 3' />
									<exp exp='LEDData[3][0] = 0 //BLU' />
									<exp exp='LEDData[3][1] = 0 //GRN' />
									<exp exp='LEDData[3][2] = 0 //RED' />
									<exp exp='//LED 4' />
									<exp exp='LEDData[4][0] = 0 //BLU' />
									<exp exp='LEDData[4][1] = 0 //GRN' />
									<exp exp='LEDData[4][2] = 0 //RED' />
									<exp exp='//LED 5' />
									<exp exp='LEDData[5][0] = 0 //BLU' />
									<exp exp='LEDData[5][1] = 0 //GRN' />
									<exp exp='LEDData[5][2] = 0 //RED' />
									<exp exp='//LED 6' />
									<exp exp='LEDData[6][0] = 0 //BLU' />
									<exp exp='LEDData[6][1] = 0 //GRN' />
									<exp exp='LEDData[6][2] = 0 //RED' />
									<exp exp='//LED 7' />
									<exp exp='LEDData[7][0] = 0 //BLU' />
									<exp exp='LEDData[7][1] = 64 //GRN' />
									<exp exp='LEDData[7][2] = 0 //RED' />
								</command>
								<command class_type='call' title='Call Macro' macro='FuncSetLEDGeneral' >
									<argument exp='8' />
								</command>
								<command class_type='delay' title='Delay' exp='500' type='1' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='4627d2fb-b41e-44cf-b125-e8511e5ebaa4' vmin='2' vmaj='1' codename='SPI_Master1' x='0' y='16' z='0.755' xsz='60' ysz='26' zsz='1.51' 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='PR_SCALE' data='016' />
					<value target='CKP' data='000' />
					<value target='CKE' data='000' />
					<value target='SMP' data='000' />
					<value target='DAC_En' data='$PORTB.7' />
					<value target='NVM_En' data='$PORTB.6' />
					<value target='MOSI' data='$PORTC.7' />
					<value target='MISO' data='$PORTB.0' />
					<value target='CLK' data='$PORTB.1' />
					<value target='MosiRemap' data='' />
					<value target='MisoRemap' data='' />
					<value target='ClkRemap' data='' />
					<value target='label' data='SPI  Master' />
					<value target='ScopeTraces' data='0' />
					<value target='ConsoleData' data='0' />
					<value target='Injector' data='000' />
					<value target='InjectorHandle' data='0' />
				</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='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='25' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel3d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAAHAMAAE4CAAA' zoom='75' scrollx='0' scrolly='29' flags='0' />
		<view type='0' name='FuncSetLEDGeneral' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAAHAMAAE4CAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
