<root>
<document scada='0' projtype='1' schema='103' license='1,79829088,Q2XNNM' title='max&amp;219 8 segment display component' description='' fcversion='720896' target='PIC.18F.18F46K80' >
	<config data='!0,22bf!10,50ff!20,ffff!30,ffff!40,ffff!50,ffff!60,ffff%0,1%2,1%3,3%6,0%8,2%c,0%e,0%f,0%10,1%11,3%13,3%15,3%18,0%1a,14%28,1%2b,1%2f,1%30,1%34,1%37,1%40,1%41,1%42,1%43,1%4e,1%4f,1%50,1%51,1%52,1%53,1%5d,1%5e,1%5f,1%60,1%61,1%62,1%63,1%6e,1' clkspd='20000000' simspd='0' usewdt='1' constif='0' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug >
		<watch expr='DisplayString.out' />
		<watch expr='DisplayHex.buf' />
	</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='1' />
			<data name='ClockPin' value='6' />
			<data name='DataPort' value='1' />
			<data name='DataPin' value='7' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='9' />
			<data name='CalculatedCommsDelay' value='9' />
			<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='0' center='1' unitscale='0' fixedscale='0' fixedx='25' fixedy='25' fixedz='25' headcode='0' />
		<definition guid='39c5a4e5-d190-4bf7-826e-5a1372575175' vstate='40' vmin='0' vmaj='1' srcleaf='max7219.fcfx' visiblename='MAX7219 7 Seg display' description='A simple MAX7219 8-segment display handler.
Displays 0..9 A..F,  &apos; &apos;, &apos;_&apos;, E, H, L, P, o, r
Decimal points use the dp LED' category='Development' category2='' category3='' bIs2dOnly='0' bIs3dOnly='0' bIsWysiwyg='0' catenable='1' author='Martin Fisher' manuname='' manucode='' sysinfo='779' keywords='MAX7219|Display|8Segment|' dynamic='1' scadaCompatible='0' embeddedCompatible='1' showmacros='1' iconpath='' />
		<component class_type='root' codename='MAX72197Seg' panelId='-1' 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' ancTop='0' ancBottom='0' ancLeft='0' ancRight='0' ancMinX='0' ancMinY='0' comp2dType='0' >
			<resources />
			<properties >
				<property name='Connections' folder='cal_spi1::property_2' hidden='0' >
					<property name='Channel' target='cal_spi1::CHANNEL' typeid='16' hidden='0' locked='0' info='SPI Channel selector' filter='000Software
001Channel 1
' />
					<property name='MOSI' target='cal_spi1::MOSI' typeid='5' hidden='0' locked='0' info='SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.' />
					<property name='MOSI Remap Pin' target='cal_spi1::MOSIPins' typeid='16' hidden='1' locked='0' info='Select which the target pin to assign the MOSI hardware pin functionality.' filter='008$PORTB.0
009$PORTB.1
010$PORTB.2
011$PORTB.3
012$PORTB.4
013$PORTB.5
014$PORTB.6
015$PORTB.7
000$PORTC.0
001$PORTC.1
002$PORTC.2
003$PORTC.3
004$PORTC.4
005$PORTC.5
006$PORTC.6
007$PORTC.7
' />
					<property name='MISO' target='cal_spi1::MISO' typeid='5' hidden='0' locked='0' info='SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.' />
					<property name='CLK' target='cal_spi1::CLK' typeid='5' hidden='0' locked='0' info='SPI Clock Pin CLK - The Clock signal is driven by the SPI master.' />
					<property name='MISO Remap Pin' target='cal_spi1::MISOPins' typeid='16' hidden='1' locked='0' info='Select which the target pin to assign the MISO hardware pin functionality.' filter='008$PORTB.0
009$PORTB.1
010$PORTB.2
011$PORTB.3
012$PORTB.4
013$PORTB.5
014$PORTB.6
015$PORTB.7
016$PORTC.0
017$PORTC.1
018$PORTC.2
019$PORTC.3
020$PORTC.4
021$PORTC.5
022$PORTC.6
023$PORTC.7
' />
					<property name='CLK Remap Pin' target='cal_spi1::CLKPins' typeid='16' hidden='1' locked='0' info='Select which the target pin to assign the CLK hardware pin functionality.' filter='008$PORTB.0
009$PORTB.1
010$PORTB.2
011$PORTB.3
012$PORTB.4
013$PORTB.5
014$PORTB.6
015$PORTB.7
000$PORTC.0
001$PORTC.1
002$PORTC.2
003$PORTC.3
004$PORTC.4
005$PORTC.5
006$PORTC.6
007$PORTC.7
' />
					<property name='Use Auto CS' target='cal_spi1::UseAutoCS' typeid='7' hidden='0' locked='0' info='Allow the SPI component to manage the CS pin for us in Master mode.
On initialise the CS pin is automatically set high to disable the remote SPI device.
Set to No if you want to create a component with multiple CS pins or if you want to manage the CS pin yourself.' />
					<property name='Use Slave Select' target='cal_spi1::UseCS' typeid='7' hidden='1' locked='0' info='Allows the SPI Slave to monitor the hardware SS pin to enable the SPI perpheral.
No: SS pin will not be used and can be used as standard IO
Yes: SS pin will be used to automatically enable the SPI interface when low.' />
					<property name='CS / SS' target='cal_spi1::SS' typeid='5' hidden='0' locked='0' info='Chip Select / Slave Select Pin 
Master Mode: General purpose output pin used to select the remote SPI device.
Slave Mode: Hardware chip select pin input used to select the SPI device.
' />
					<property name='CS Polarity' target='cal_spi1::CSPolarity' typeid='16' hidden='0' locked='0' info='' filter='000Active Low
001Active High' />
					<property name='SS Remap Pin' target='cal_spi1::SSPins' typeid='16' hidden='1' locked='0' info='Select which the target pin to assign the SS hardware pin functionality.' />
					<property name='Alt SS Pin' target='cal_spi1::AltSSPin' typeid='7' hidden='1' locked='0' info='Allows an alternative SS hardware pin to be used.' />
				</property>
				<property name='Options' folder='cal_spi1::property_3' hidden='0' >
					<property name='Mode' target='cal_spi1::Mode' typeid='16' hidden='0' locked='0' info='Configures the mode of the SPI component.
Currently only Master mode is supported.' filter='000Master
001Slave' />
					<property name='Prescale' target='cal_spi1::PR_SCALE' typeid='16' hidden='0' locked='0' info='Prescale option selector' filter='004Fosc/4
016Fosc/16
064Fosc/64' />
					<property name='Clock Phase' target='cal_spi1::CKE' typeid='16' hidden='0' locked='0' info='Clock Phase (data change edge) selection' filter='000Leading Edge
001Trailing Edge' />
					<property name='Clock Polarity' target='cal_spi1::CKP' typeid='16' hidden='0' locked='0' info='Clock Polarity setting, inactive (idle) state' filter='000Idle Low
001Idle High' />
					<property name='Sample Point' target='cal_spi1::SMP' typeid='16' hidden='0' locked='0' info='Data bit read sample point' filter='000Middle
001End' />
					<property name='R-&gt;L or L-&gt;R' target='left_to_right' typeid='16' hidden='0' locked='0' info='R-&gt;L Rightmost diigit is number 1
L-&gt;R Letmost digit is 1

If display is reversed swap.' filter='000R-&gt;L
001L-&gt;R' />
				</property>
				<property name='Digits' target='digs' typeid='16' hidden='0' locked='0' info='Number of digts supported 1..8' filter='0011
0022
0033
0044
0055
0066
0077
0088' />
			</properties>
			<values >
				<value target='cal_spi1::CHANNEL' data='000' />
				<value target='cal_spi1::MOSI' data='$PORTC.3' />
				<value target='cal_spi1::MOSIPins' data='008' />
				<value target='cal_spi1::MISO' data='$PORTB.3' />
				<value target='cal_spi1::CLK' data='$PORTD.0' />
				<value target='cal_spi1::MISOPins' data='013' />
				<value target='cal_spi1::CLKPins' data='004' />
				<value target='cal_spi1::UseAutoCS' data='1' />
				<value target='cal_spi1::UseCS' data='0' />
				<value target='cal_spi1::SS' data='$PORTD.1' />
				<value target='cal_spi1::CSPolarity' data='000' />
				<value target='cal_spi1::SSPins' data='000' />
				<value target='cal_spi1::AltSSPin' data='0' />
				<value target='cal_spi1::Mode' data='000' />
				<value target='cal_spi1::PR_SCALE' data='004' />
				<value target='cal_spi1::CKE' data='000' />
				<value target='cal_spi1::CKP' data='001' />
				<value target='cal_spi1::SMP' data='000' />
				<value target='left_to_right' data='000' />
				<value target='digs' data='008' />
			</values>
			<events />
			<apis >
				<api name='DisplayString' alt='DisplayString' type='1' proto='1' />
				<api name='DisplayInt' alt='' type='1' proto='1' />
				<api name='SetBrightness' alt='SetBrightness' type='1' proto='1' />
				<api name='DisplayHex' alt='DisplayHex' type='1' proto='1' />
				<api name='DisplayFloat' alt='DisplayFloat' type='1' proto='1' />
				<api name='Power' alt='Power' type='1' proto='1' />
				<api name='Initialise' alt='Initialise' type='1' proto='1' />
			</apis>
			<variables >
				<variable public='0' >
					<def class_type='variable' name='false' type='b1' description='' isconst='1' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='DIGITS' type='u8' description='Bit patterns for the digits 0..9 and A..F' isconst='1' isHidden='0' isinit='1' usrinit='&quot; 0x7E, 0x30, 0x6d, 0x79, 0x33, 0x5B, 0x5F, 0x70, 0x7F, 0x7B, 0x77, 0x1F, 0x4E, 0x3D, 0x4f, 0x47 &quot;' setinit='{0x7E, 0x30, 0x6d, 0x79, 0x33, 0x5B, 0x5F, 0x70, 0x7F, 0x7B, 0x77, 0x1F, 0x4E, 0x3D, 0x4f, 0x47}' >
						<array size='16' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='true' type='b1' description='' isconst='1' isHidden='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='DisplayString' description='If text is longer than display extra characters are dropped' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='str' type='T8*' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='20' />
						</param>
						<param name='left_justify' type='b1' description='Set true for left justify false for right' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='c' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='len' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='i' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='dir' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='pos' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='segs' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='out' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='20' />
						</local>
						<command class_type='call' title='User Macro' macro='FixDP' >
							<return exp='.out' />
							<argument exp='.str' />
							<argument exp='0' />
						</command>
						<command class_type='call' title='User Macro' macro='PadString' >
							<return exp='.out' />
							<argument exp='.out' />
							<argument exp='.left_justify' />
						</command>
						<command class_type='loop' title='Loop' type='2' forvar='.i' exp='digs' start='0' >
							<flowline >
								<command class_type='decision' title='Decision' exp='left_to_right' swap='0' >
									<flowline >
										<command class_type='call' title='User Macro' macro='SetRegister' >
											<argument exp='.i + 1' />
											<argument exp='GetSegmentPattern(.out[.i])' />
										</command>
									</flowline>
									<flowline >
										<command class_type='call' title='User Macro' macro='SetRegister' >
											<argument exp='.i + 1' />
											<argument exp='GetSegmentPattern(.out[digs - .i - 1])' />
										</command>
									</flowline>
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='DisplayInt' description='Display an integer to the display - no check is made that it will fit into the available digits.' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='x' type='u32' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='left_justify' type='b1' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='buf' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='8' />
						</local>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.buf = ToString$(.x)' />
						</command>
						<command class_type='call' title='User Macro' macro='DisplayString' >
							<argument exp='.buf' />
							<argument exp='.left_justify' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='SetBrightness' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='level' type='u8' description='Set brightness level 0..15' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='SetRegister' >
							<argument exp='0x0A' />
							<argument exp='.level' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='GetSegmentPattern' description='' statediag='0' >
						<return name='Return' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='char' type='u8' description='Get 0..9, A..F, a..f &apos; &apos;. H, L, P, o, r, u, &apos;-&apos; OR &apos;_&apos;' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='pos' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='255' setinit='255' />
						<local name='dp' type='b1' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='calculation' title='Check if dp needs to be set' >
							<exp exp='.Return = 0' />
							<exp exp='.dp = .char &amp; 0x80' />
							<exp exp='.char = .char &amp; 0x7f' />
						</command>
						<command class_type='decision' title='Decision' exp='(.char &gt;= &apos;0&apos;) &amp;&amp; (.char &lt;= &apos;9&apos;)' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='.pos = .char - &apos;0&apos;' />
								</command>
							</flowline>
							<flowline >
								<command class_type='decision' title='Decision' exp='(.char &gt;= &apos;A&apos;) &amp;&amp; (.char &lt;= &apos;F&apos;)' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' >
											<exp exp='.pos = .char - &apos;A&apos; + 10' />
										</command>
									</flowline>
									<flowline >
										<command class_type='decision' title='Decision' exp='(.char &gt;= &apos;a&apos;) &amp;&amp; (.char &lt;= &apos;f&apos;)' swap='0' >
											<flowline >
												<command class_type='calculation' title='Calculation' >
													<exp exp='.pos = .char - &apos;a&apos; + 10' />
												</command>
											</flowline>
											<flowline />
										</command>
									</flowline>
								</command>
							</flowline>
						</command>
						<command class_type='decision' title='Decision' exp='.pos = 255' swap='0' >
							<flowline >
								<command class_type='switch' title='Switch' textarea='36,25,36,25' exp='.char' >
									<case >
										<flowline />
									</case>
									<case exp='&apos;H&apos;' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Return = 0x37' />
											</command>
										</flowline>
									</case>
									<case exp='&apos;L&apos;' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Return = 0x0E' />
											</command>
										</flowline>
									</case>
									<case exp='&apos;P&apos;' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Return = 0x67' />
											</command>
										</flowline>
									</case>
									<case exp='&apos;o&apos;' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Return = 0x1D' />
											</command>
										</flowline>
									</case>
									<case exp='&apos;r&apos;' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Return = 0x05' />
											</command>
										</flowline>
									</case>
									<case exp='&apos;U&apos;' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Return = 0x3E' />
											</command>
										</flowline>
									</case>
									<case exp='&apos;-&apos;' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Return = 0x01' />
											</command>
										</flowline>
									</case>
									<case exp='&apos;_&apos;' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Return = 0x08' />
											</command>
										</flowline>
									</case>
									<case exp='&apos; &apos;' >
										<flowline >
											<command class_type='calculation' title='Calculation' >
												<exp exp='.Return = 0x00' />
											</command>
										</flowline>
									</case>
								</command>
							</flowline>
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='.Return = DIGITS[.pos]' />
								</command>
							</flowline>
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.Return = .Return | .dp' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='SendMAX7219' description='Send data to MAX7219 - toggle CS after each addr, data pair to latch data' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='data' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='10' />
						</param>
						<param name='count' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='i' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='buf' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='2' />
						</local>
						<command class_type='loop' title='Loop' type='0' exp='.i &lt; .count' >
							<flowline >
								<command class_type='call' title='User Macro' macro='SetRegister' >
									<argument exp='.data[.i]' />
									<argument exp='.data[.i + 1]' />
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.i = .i + 2' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='DisplayHex' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='x' type='u32' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='left_justify' type='b1' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='buf' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='10' />
						</local>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.buf = NumberToHex$(.x)' />
							<exp exp='.buf = RemoveFromString$(.buf,2,0)' />
						</command>
						<command class_type='call' title='User Macro' macro='DisplayString' >
							<argument exp='.buf' />
							<argument exp='.left_justify' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='SetRegister' description='SetDigit - rightmost is 1, leftmost number of displays to a segment pattern' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='addr' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='data' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='buf' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='2' />
						</local>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.buf[0] = .addr' />
							<exp exp='' />
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.buf[1] = .data' />
						</command>
						<command class_type='call' title='Component Macro' component='SPI_Master1' macro='Enable_CS' />
						<command class_type='call' title='Component Macro' component='SPI_Master1' macro='SendByteArray' >
							<argument exp='2' />
							<argument exp='.buf' />
						</command>
						<command class_type='call' title='Component Macro' component='SPI_Master1' macro='Disable_CS' />
					</flowline>
				</macro>
				<macro >
					<flowline name='FixDP' description='' statediag='0' >
						<return name='Return' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='2000' />
						</return>
						<param name='str' type='T8*' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='20' />
						</param>
						<param name='pos' type='u8' description='Set to 0 for left, 1 for none, 2 for right' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='len' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='i' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='c' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='result' type='T8' description='' isconst='0' isHidden='0' isinit='1' usrinit='&quot;&quot;' setinit='&quot;&quot;' >
							<array size='18' />
						</local>
						<local name='out_pos' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.len = Length$(.str)' />
							<exp exp='.c = 0' />
							<exp exp='.i = 0' />
						</command>
						<command class_type='loop' title='Loop' type='0' exp='.i &lt; .len' >
							<flowline >
								<command class_type='decision' title='Decimal point needs handling differently' exp='.str[.i] = &apos;.&apos;' swap='0' >
									<flowline >
										<command class_type='decision' title='No preceeding character' exp='.c == 0' swap='0' >
											<flowline >
												<command class_type='calculation' title='Calculation' >
													<exp exp='.result[.out_pos] = &apos; &apos; | 0x80' />
													<exp exp='.out_pos = .out_pos + 1' />
												</command>
											</flowline>
											<flowline >
												<command class_type='calculation' title='Set dp on preceeding char' >
													<exp exp='.c = 0' />
													<exp exp='.result[.out_pos - 1] = .result[.out_pos - 1] | 0x80' />
													<exp exp='' />
												</command>
											</flowline>
										</command>
									</flowline>
									<flowline >
										<command class_type='calculation' title='Calculation' >
											<exp exp='.c = .str[.i]' />
											<exp exp='.result[.out_pos] = .c' />
											<exp exp='.out_pos = .out_pos + 1' />
										</command>
									</flowline>
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.i = .i + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.result[.out_pos] = 0' />
							<exp exp='.Return = .result' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='PadString' description='Pads the string to fill all the display digits - so numbers are disp
correctly' statediag='0' >
						<return name='Return' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='2000' />
						</return>
						<param name='str' type='T8*' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='20' />
						</param>
						<param name='pad' type='u8' description='Send 0 to pad let, 1 - no padding, 2 pad right' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='len' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='i' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='res' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='20' />
						</local>
						<local name='pad_needed' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.len = Length$(.str)' />
						</command>
						<command class_type='decision' title='Decision' exp='.len &lt; digs' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='.pad_needed = digs - .len' />
								</command>
								<command class_type='loop' title='Loop' type='0' exp='.i &lt; .pad_needed' >
									<flowline >
										<command class_type='calculation' title='Calculation' >
											<exp exp='.res[.i] = &apos; &apos;' />
											<exp exp='.i = .i + 1' />
										</command>
									</flowline>
								</command>
								<command class_type='calculation' title='Mark end of string' >
									<exp exp='.res[.pad_needed] = 0' />
								</command>
								<command class_type='decision' title='Decision' exp='.pad == 0' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' >
											<exp exp='.Return = .res + .str' />
										</command>
									</flowline>
									<flowline >
										<command class_type='calculation' title='Calculation' >
											<exp exp='.Return = .str + .res' />
										</command>
									</flowline>
								</command>
							</flowline>
							<flowline />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<local name='b' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='call' title='User Macro' macro='Initialise' >
							<argument exp='2' />
						</command>
						<command class_type='loop' title='Loop' type='3' exp='1' >
							<flowline >
								<command class_type='call' title='User Macro' macro='Power' >
									<argument exp='0' />
								</command>
								<command class_type='delay' title='Delay' exp='10' type='2' />
								<command class_type='call' title='User Macro' macro='Power' >
									<argument exp='1' />
								</command>
								<command class_type='call' title='User Macro' macro='SetBrightness' >
									<argument exp='.b' />
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='.b = (.b + 1) % 15' />
								</command>
								<command class_type='call' title='User Macro' macro='DisplayString' >
									<argument exp='&quot;HELL0&quot;' />
									<argument exp='0' />
								</command>
								<command class_type='delay' title='Delay' exp='10' type='2' />
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='DisplayFloat' description='Display a floating point string ' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='x' type='f32' description='' isconst='0' isHidden='0' isinit='0' usrinit='0.0' setinit='' />
						<param name='digits' type='u8' description='Number of digits after the dp' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='left_jusify' type='b1' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='buf' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='10' />
						</local>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.buf = FloatToString$(.x,.digits)' />
						</command>
						<command class_type='call' title='User Macro' macro='DisplayString' >
							<argument exp='.buf' />
							<argument exp='.left_jusify' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Power' description='Turn the display on (send true) or off (low power mode) false (0)' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='on' type='b1' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='SetRegister' >
							<argument exp='0x0C' />
							<argument exp='.on' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Initialise' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='brightness' type='u8' description='Set initial display brightness (0-15)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='setup' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='&quot; 0x09, 0x00, 0x0A, 0x07, 0x0B, 0x07, 0x0c, 0x01, 0x0F, 0x00 &quot;' setinit='{0x09, 0x00, 0x0A, 0x07, 0x0B, 0x07, 0x0c, 0x01, 0x0F, 0x00}' >
							<array size='10' />
						</local>
						<command class_type='delay' title='Delay' exp='100' type='1' />
						<command class_type='call' title='Component Macro' component='SPI_Master1' macro='Initialise' />
						<command class_type='calculation' title='Calculation' >
							<exp exp='.setup[3] = .brightness % 15' />
							<exp exp='.setup[5] = digs - 1' />
						</command>
						<command class_type='call' title='User Macro' macro='SendMAX7219' >
							<argument exp='.setup' />
							<argument exp='10' />
						</command>
						<command class_type='delay' title='Delay' exp='10' type='1' />
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='96862c4d-debc-45fa-9433-74711a4b9a3b' vmin='1' vmaj='2' codename='SPI_Master1' panelId='0' x='123' y='-124' z='0' xsz='25.1778' ysz='25.1392' 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='2' poslock='0' ancTop='0' ancBottom='0' ancLeft='0' ancRight='0' ancMinX='0' ancMinY='0' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='cal_spi::CHANNEL' data='000' />
					<value target='cal_spi::MOSI' data='$PORTC.3' />
					<value target='cal_spi::MOSIPins' data='008' />
					<value target='cal_spi::MISO' data='$PORTD.7' />
					<value target='cal_spi::MISOPins' data='013' />
					<value target='cal_spi::CLK' data='$PORTD.0' />
					<value target='cal_spi::CLKPins' data='004' />
					<value target='cal_spi::UseAutoCS' data='1' />
					<value target='cal_spi::SS' data='$PORTD.1' />
					<value target='cal_spi::PR_SCALE' data='016' />
					<value target='cal_spi::CKE' data='001' />
					<value target='cal_spi::CKP' data='000' />
					<value target='cal_spi::SMP' data='000' />
					<value target='label' data='SPI  Master' />
					<value target='cal_spi::ScopeTraces' data='1' />
					<value target='cal_spi::ConsoleData' data='1' />
					<value target='cal_spi::Injector' data='000' />
					<value target='cal_spi::InjectorCS' data='' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<scadaresourcelookup />
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' >
		<background rgb='9737364' img='' style='0' />
		<camera xe='0' ye='0' ze='523.883' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<viewport dx='252' dy='284' zoom='58.2038' fix_topleft='0' />
		<page x='1000' y='1000' show='0' rgb='7360576' />
		<winpos ID='7005' RectRecentFloat='1455,518,1847,896' RectRecentDocked='0,0,252,325' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='0' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
	</panel2d>
	<panel3d shadows='0' lighting='2' brightness='0' perspective='1' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='62' />
		<camera xe='0' ye='0' ze='781.66' 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' />
		<winpos ID='7004' RectRecentFloat='630,318,1280,768' RectRecentDocked='0,0,252,1435' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='0' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
	</panel3d>
	<panels2d count='1' >
		<panel2d_0 id='0' name='2D Panel' type='0' >
			<winpos ID='1171' RectRecentFloat='519,283,1169,733' RectRecentDocked='1193,286,1445,1566' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='0' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
			<background fill='288230376151053813' showgrid='1' gridstyle='1' gridsize='10' gridbrush='71776119075691740' snaptogrid='1' fitcomp='0' disp_x='300' disp_y='400' scale='100' disp_col='16777215' />
		</panel2d_0>
	</panels2d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='180' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Initialise' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='200' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='DisplayInt' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='190' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='SendMAX7219' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='180' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='GetSegmentPattern' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='150' scrollx='0' scrolly='72' flags='0' />
		<view type='0' name='DisplayFloat' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='150' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='SetRegister' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='150' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='DisplayString' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='220' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='FixDP' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='220' scrollx='0' scrolly='248' flags='0' />
		<view type='0' name='PadString' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='180' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='DisplayHex' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='260' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='SetBrightness' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='200' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Power' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAhAoAAMgGAAA' zoom='180' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
