<root>
<document scada='0' schema='102' license='1,mnfisher,5YZWG2' title='' description='' fcversion='524802' target='ARD.ATMEGA.Arduino Nano 328' >
	<config data='' clkspd='16000000' simspd='1' usewdt='0' constif='0' commport='3' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug />
	<traces />
	<ghost >
		<FK2 >
			<data name='FK2D0' port='4294967295' pin='4294967295' />
			<data name='FK2D1' port='4294967295' pin='4294967295' />
			<data name='FK2D2' port='4294967295' pin='4294967295' />
			<data name='FK2D3' port='4294967295' pin='4294967295' />
			<data name='FK2D4' port='4294967295' pin='4294967295' />
			<data name='FK2D5' port='4294967295' pin='4294967295' />
			<data name='FK2D6' port='4294967295' pin='4294967295' />
			<data name='FK2D7' port='4294967295' pin='4294967295' />
			<data name='FK2D8' port='4294967295' pin='4294967295' />
			<data name='FK2D9' port='4294967295' pin='4294967295' />
			<data name='FK2D10' port='4294967295' pin='4294967295' />
			<data name='FK2D11' port='4294967295' pin='4294967295' />
			<data name='FK2D12' port='4294967295' pin='4294967295' />
			<data name='FK2D13' port='4294967295' pin='4294967295' />
			<data name='FK2D14' port='4294967295' pin='4294967295' />
			<data name='FK2D15' port='4294967295' pin='4294967295' />
			<data name='FK2A0' port='4294967295' pin='4294967295' />
			<data name='FK2A1' port='4294967295' pin='4294967295' />
			<data name='FK2A2' port='4294967295' pin='4294967295' />
			<data name='FK2A3' port='4294967295' pin='4294967295' />
			<data name='FK2A4' port='4294967295' pin='4294967295' />
			<data name='FK2A5' port='4294967295' pin='4294967295' />
		</FK2>
		<ICD >
			<data name='AnalogPrescaleValue' value='19' />
			<data name='DigitalSampleRate' value='100000' />
			<data name='BreakpointCount' value='8' />
			<data name='CallStackDepthCount' value='8' />
			<data name='ClockPort' value='1' />
			<data name='ClockPin' value='1' />
			<data name='DataPort' value='1' />
			<data name='DataPin' value='0' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='11' />
			<data name='CalculatedCommsDelay' value='11' />
			<data name='AnalogEB2PrescaleValue' value='2' />
			<data name='DigitalEB2SampleRate' value='100000' />
		</ICD>
		<pins >
			<digital A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
			<analog A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
		</pins>
	</ghost>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='7dbd43e9-1458-4378-8bd3-58c7600b37b9' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='1' scadaCompatible='0' embeddedCompatible='1' iconpath='' />
		<component class_type='root' codename='panel' x='0' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' >
			<resources />
			<properties >
				<property name='bme680' target='bme_i2c' typeid='21' hidden='0' locked='0' hexview='1' info='' />
			</properties>
			<values >
				<value target='bme_i2c' data='119' />
			</values>
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='Ctrl_hum' type='s16' description='Oversampling for humiditty' isconst='1' isinit='1' usrinit='114' setinit='0x72' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='false' type='b1' description='' isconst='1' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Gas_wait' type='s16' description='' isconst='1' isinit='1' usrinit='100' setinit='0x64' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Ctrl_meas' type='s16' description='' isconst='1' isinit='1' usrinit='116' setinit='0x74' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Res_heat' type='s16' description='' isconst='1' isinit='1' usrinit='90' setinit='0x5a' />
				</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='Force_read' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<local name='d' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadByte' >
							<return exp='.d' />
							<argument exp='Ctrl_meas' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='SendByte' >
							<argument exp='Ctrl_meas' />
							<argument exp='.d | 1' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='GetTempInt' description='' >
						<return name='Return' type='s16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='temp_adc' type='s32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='par_t1' type='s32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='par_t2' type='s32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='par_t3' type='s32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='t' type='s16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='d' type='u8' description='Read buffer for data' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='3' />
						</local>
						<local name='var_1' type='u32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='var_2' type='u32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='var_3' type='u32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='t_fine' type='u32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadBytes' >
							<argument exp='0xE9' />
							<argument exp='2' />
							<argument exp='.d' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.t = .d[0] + (.d[1] &lt;&lt; 8)' />
							<exp exp='.par_t1 = .t // Extend to 32 bit' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadBytes' >
							<argument exp='0x8A' />
							<argument exp='3' />
							<argument exp='.d' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.t = .d[0] + (.d[1] &lt;&lt; 8)' />
							<exp exp='.par_t2 = .t' />
							<exp exp='.par_t3 = .d[2]' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadBytes' >
							<argument exp='0x22' />
							<argument exp='3' />
							<argument exp='.d' />
						</command>
						<command class_type='calculation' title='Get temp adc - different byte order to LSB' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.temp_adc = .d[0]' />
							<exp exp='.temp_adc = (.temp_adc &lt;&lt; 8) + .d[1]' />
							<exp exp='.temp_adc = (.temp_adc &lt;&lt; 4) + (.d[2] &gt;&gt; 4)' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.var_1 = (.temp_adc &gt;&gt; 3) - (.par_t1 &lt;&lt; 1)' />
							<exp exp='.var_2 = (.var_1 * .par_t2) &gt;&gt; 11' />
							<exp exp='.var_3 = (((.var_1 &gt;&gt; 1) * (.var_1 &gt;&gt; 1)) &gt;&gt; 12) * (.par_t3 &lt;&lt; 4) &gt;&gt; 14' />
							<exp exp='.t_fine = .var_2 + .var_3' />
							<exp exp='.Return = ((.t_fine * 5) + 128) &gt;&gt; 8' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='pf' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<param name='desc' type='T8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='20' />
						</param>
						<param name='x' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='tstr' type='T8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='20' />
						</local>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
							<argument exp='.desc' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.tstr = FloatToString$ (.x)' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
							<argument exp='.tstr' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
							<argument exp='&quot;\r\n&quot;' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='GetHumidityFloat' description='' >
						<return name='Return' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<param name='temp_comp' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='h1' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='h2' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='h3' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='h4' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='h5' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='h6' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='h7' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='hadc' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='d' type='u8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='8' />
						</local>
						<local name='v1' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='v2' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='v3' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='v4' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='adc' type='u16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadBytes' >
							<argument exp='0xE1' />
							<argument exp='8' />
							<argument exp='.d' />
						</command>
						<command class_type='calculation' title='Set up calibration parameters' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.h1 = (.d[1] &gt;&gt; 4) + .d[2] &lt;&lt; 4' />
							<exp exp='.h2 = (.d[1] &gt;&gt; 4) + .d[0] &lt;&lt; 4' />
							<exp exp='.h3 = .d[3]' />
							<exp exp='.h4 = .d[4]' />
							<exp exp='.h5 = .d[5]' />
							<exp exp='.h6 = .d[6]' />
							<exp exp='.h7 = .d[7]' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadBytes' >
							<argument exp='0x25' />
							<argument exp='2' />
							<argument exp='.d' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.adc = (.d[0] &lt;&lt; 8) + .d[1]' />
							<exp exp='.hadc = .adc' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.v1 = .hadc - ((.h1 * 16.0) + ((.h3 / 2.0) * .temp_comp))' />
							<exp exp='.v2 = .v1 * ((.h2 / 262144.0) * (1.0 + ((.h4 / 16384.0) * .temp_comp) + (((.h5 / 1048576.0) * .temp_comp * .temp_comp))))' />
							<exp exp='.v3 = .h6 / 16384.0' />
							<exp exp='.v4 = .h7 / 2097152.0' />
							<exp exp='.Return = .v2 + ((.v3 + (.v4 * .temp_comp)) * .v2 * .v2)' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='SendByte' description='Send a single byte to RTC chip' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<param name='addr' type='u8' description='Address to control register' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='data' type='u8' description='data to send' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Start' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='bme_i2c &lt;&lt; 1' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='.addr' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='.data' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Stop' />
					</flowline>
				</macro>
				<macro >
					<flowline name='SendBytes' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<param name='addr' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='n' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='data' type='u8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='3' />
						</param>
						<local name='i' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Start' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='bme_i2c &lt;&lt; 1' />
						</command>
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='2' forvar='.i' exp='.n' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
									<argument exp='.addr' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
									<argument exp='.data[.i]' />
								</command>
								<command class_type='calculation' title='Address is not auto-incremented' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='.addr = .addr + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Stop' />
					</flowline>
				</macro>
				<macro >
					<flowline name='DumpData' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<local name='d' type='u8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='7' />
						</local>
						<local name='i' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadBytes' >
							<argument exp='0x20' />
							<argument exp='7' />
							<argument exp='.d' />
						</command>
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='2' forvar='.i' exp='7' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendNumber' >
									<argument exp='.d[.i]' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendChar' >
									<argument exp='&apos; &apos;' />
								</command>
							</flowline>
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
							<argument exp='&quot;\r\n&quot;' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='SetOversampling' description='Set the over sampling rates
0 = skip, 1 = 1x, 2 = 2x, 3 = 4x, 4=8x, 5=16x' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<param name='humidity' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='temperature' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='pressure' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='c_hum' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='c_meas' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadByte' >
							<return exp='.c_hum' />
							<argument exp='Ctrl_hum' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadByte' >
							<return exp='.c_meas' />
							<argument exp='Ctrl_meas' />
						</command>
						<command class_type='calculation' title='Get a 3 bit value for each oversampling rate' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.humidity = .humidity &amp; 0b111' />
							<exp exp='.temperature = (.temperature &amp; 0b111) &lt;&lt; 5' />
							<exp exp='.pressure = (.pressure &amp; 0b111) &lt;&lt; 2' />
							<exp exp='.c_hum = .c_hum | .humidity' />
							<exp exp='.c_meas = (.c_meas &amp; 0b11) | .temperature | .pressure' />
							<exp exp='' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='SendByte' >
							<argument exp='Ctrl_hum' />
							<argument exp='.c_hum' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='SendByte' >
							<argument exp='Ctrl_meas' />
							<argument exp='.c_meas' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Set_Gas_wait' >
							<argument exp='0' />
							<argument exp='0' />
							<argument exp='0' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Set_Gas_wait' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<param name='x' type='u8' description='0..9 for 10 available settings' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='ms' type='u8' description='time in ms (bits &lt;0..5&gt;)' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='multiplier' type='u8' description='0 = 1x, 1 = 4x, 2 = 16x, 3 = 64x' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='d' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.d = (.multiplier &lt;&lt; 6) | .ms' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='SendByte' >
							<argument exp='Gas_wait + .x' />
							<argument exp='.d' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='ReadByte' description='' >
						<return name='Return' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='addr' type='u8' description='Address of control register to read' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Start' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='bme_i2c &lt;&lt; 1' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='.addr' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Restart' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='(bme_i2c &lt;&lt; 1)| 1' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_RxByte' >
							<return exp='.Return' />
							<argument exp='1' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Stop' />
					</flowline>
				</macro>
				<macro >
					<flowline name='GetTempFloat' description='' >
						<return name='Return' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='temp_adc' type='s32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='t' type='s16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='d' type='u8' description='Read buffer for data' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='7' />
						</local>
						<local name='t_fine' type='u32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='t1' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='t2' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='t3' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='v1' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='v2' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='v3' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='tfine' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='adc' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='vtemp' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadBytes' >
							<argument exp='0xE9' />
							<argument exp='2' />
							<argument exp='.d' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.t = .d[0] + (.d[1] &lt;&lt; 8)' />
							<exp exp='.t1 = .t // Extend to 32 bit' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadBytes' >
							<argument exp='0x8A' />
							<argument exp='3' />
							<argument exp='.d' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.t = .d[0] + (.d[1] &lt;&lt; 8)' />
							<exp exp='.t2 = .t' />
							<exp exp='.t3 = .d[2]' />
						</command>
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadBytes' >
							<argument exp='0x20' />
							<argument exp='7' />
							<argument exp='.d' />
						</command>
						<command class_type='calculation' title='Get temp adc - different byte order to LSB' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.temp_adc = .d[2]' />
							<exp exp='.temp_adc = (.temp_adc &lt;&lt; 8) + .d[3]' />
							<exp exp='.temp_adc = (.temp_adc &lt;&lt; 4) + (.d[4] &gt;&gt; 4)' />
							<exp exp='.adc = .temp_adc' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='.v1 = ((.adc / 16384.0) - (.t1 / 1024.0)) * .t2' />
							<exp exp='.vtemp = (.adc / 131072.0) - (.t1 / 8192.0)' />
							<exp exp='.v2 = .vtemp * .vtemp' />
							<exp exp='.v2 = .v2 * (.t3 * 16.0)' />
							<exp exp='' />
							<exp exp='.tfine = .v1 + .v2' />
							<exp exp='.Return = .tfine / 5120.0' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='ReadBytes' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<param name='addr' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='n' type='u8' description='Number of bytes to read' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='data' type='u8' description='Bytes read from RTC' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='3' />
						</param>
						<local name='i' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Start' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='bme_i2c &lt;&lt; 1' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='.addr' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Restart' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_TxByte' >
							<argument exp='(bme_i2c &lt;&lt; 1) | 1' />
						</command>
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='2' forvar='.i' exp='.n' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_RxByte' >
									<return exp='.data[.i]' />
									<argument exp='.i == .n - 1' />
								</command>
							</flowline>
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Stop' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<local name='id' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='temperature' type='u16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='tfloat' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='tstr' type='T8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='20' />
						</local>
						<local name='humidity' type='f32' description='' isconst='0' isinit='0' usrinit='0.0' setinit='' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='Initialise' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
							<argument exp='&quot;BME 680 id = &quot;' />
						</command>
						<command class_type='call' title='Initiialise i2c bus' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Init' />
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='ReadByte' >
							<return exp='.id' />
							<argument exp='0xD0' />
						</command>
						<command class_type='call' title='Stop i2c' cmdcolor='1879295' cmdcolor_sec='5751039' component='cal_i2c1' macro='Master_Stop' />
						<command class_type='call' title='Display value 97 :-)' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendNumber' >
							<argument exp='.id' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
							<argument exp='&quot; - done\r\n&quot;' />
						</command>
						<command class_type='call' title='1' cmdcolor='1879295' cmdcolor_sec='5751039' macro='SetOversampling' >
							<argument exp='5' />
							<argument exp='5' />
							<argument exp='5' />
						</command>
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='1' >
							<flowline >
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='Force_read' />
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='GetTempFloat' >
									<return exp='.tfloat' />
								</command>
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='.tstr = FloatToString$ (.tfloat)' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
									<argument exp='&quot;Temp = &quot;' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
									<argument exp='.tstr' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
									<argument exp='&quot; GetTempInt = &quot;' />
								</command>
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='GetTempInt' >
									<return exp='.temperature' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendNumber' >
									<argument exp='.temperature' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='UART1' macro='SendString' >
									<argument exp='&quot;C\r\n&quot;' />
								</command>
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='GetHumidityFloat' >
									<return exp='.humidity' />
									<argument exp='.tfloat' />
								</command>
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='pf' >
									<argument exp='&quot;Humidity (%) &quot;' />
									<argument exp='.humidity' />
								</command>
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='DumpData' />
								<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='10' type='2' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='ed3a5141-43bb-43e0-86b0-2243fd1147ca' vmin='1' vmaj='2' codename='cal_i2c1' x='0' y='0' z='0' xsz='20' ysz='20' zsz='20' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='ENABLED' data='1' />
					<value target='REF' data='1' />
					<value target='CHANNEL' data='001' />
					<value target='Mode' data='000' />
					<value target='SDA' data='$PORTC.4' />
					<value target='SDAPins' data='000' />
					<value target='SCL' data='$PORTC.5' />
					<value target='SCLPins' data='000' />
					<value target='StopDel' data='1' />
					<value target='BAUD_LIST' data='002' />
					<value target='BAUD' data='400000' />
					<value target='SRC' data='000' />
					<value target='SMB' data='000' />
					<value target='ClockStretching' data='1' />
					<value target='BMODE' data='0' />
					<value target='SDA_PORT' data='$PORTC.4' />
					<value target='SDA_TRIS' data='$PORTC.4' />
					<value target='SDA_PIN' data='4' />
					<value target='SCL_PORT' data='$PORTC.5' />
					<value target='SCL_TRIS' data='$PORTC.5' />
					<value target='SCL_PIN' data='5' />
					<value target='MASTER' data='1' />
					<value target='ScopeTraces' data='1' />
					<value target='ConsoleData' data='1' />
					<value target='Injector' data='000' />
					<value target='InjectorHandle' data='0' />
					<value target='REMAPPABLE' data='' />
					<value target='SDABank' data='b' />
					<value target='SDABank2' data='c' />
					<value target='SCLBank' data='b' />
					<value target='SCLBank2' data='c' />
					<value target='SDARPNUM' data='21' />
					<value target='SCLRPNUM' data='20' />
					<value target='SDARPREG' data='SSP1DATPPS' />
					<value target='SCLRPREG' data='SSP1CLKPPS' />
					<value target='SDAREG' data='000' />
					<value target='SCLREG' data='001' />
					<value target='Sim' data='1' />
					<value target='ParentName' data='' />
					<value target='BitDelay' data='2' />
					<value target='SDAAlts' data='000' />
					<value target='SCLAlts' data='000' />
					<value target='SDAAlt' data='4' />
					<value target='SCLAlt' data='4' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='c73616d1-7ad0-45d9-aada-69ccfa4c5efc' vmin='0' vmaj='2' codename='UART1' x='0' y='0' z='10.765' xsz='64' ysz='32' zsz='1.53' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='cal_uart::CHANNEL' data='001' />
					<value target='cal_uart::BAUD_LIST' data='004' />
					<value target='cal_uart::BAUD' data='9600' />
					<value target='cal_uart::DBITS' data='008' />
					<value target='cal_uart::RETURN' data='000' />
					<value target='cal_uart::ECHO' data='000' />
					<value target='cal_uart::UseTX' data='1' />
					<value target='cal_uart::TX' data='$PORTD.1' />
					<value target='cal_uart::OutputPins' data='007' />
					<value target='cal_uart::TXAlt' data='0' />
					<value target='cal_uart::UseRX' data='1' />
					<value target='cal_uart::RX' data='$PORTD.0' />
					<value target='cal_uart::InputPins' data='013' />
					<value target='cal_uart::RXAlt' data='0' />
					<value target='cal_uart::FLOWEN' data='000' />
					<value target='cal_uart::RTS' data='$PORTB.2' />
					<value target='cal_uart::CTS' data='$PORTB.1' />
					<value target='label' data='UART' />
					<value target='cal_uart::ScopeTraces' data='0' />
					<value target='cal_uart::ConsoleData' data='0' />
					<value target='cal_uart::ConsoleFormat' data='000' />
					<value target='cal_uart::ConsoleColumns' data='64' />
					<value target='cal_uart::DataSource' data='000' />
					<value target='cal_uart::com_port' data='000' />
					<value target='cal_uart::Injector' data='000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<scadaresourcelookup />
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' >
		<background rgb='7292207' img='' style='0' />
		<camera xe='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='1' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='0' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey0 xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey1 xe='-3.67394e-14' ye='0' ze='-300' xt='0' yt='0' zt='0' xquat='0' yquat='1' zquat='0' wquat='6.12323e-17' />
		<camerakey2 xe='0' ye='-300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.707107' yquat='0' zquat='0' wquat='0.707107' />
		<camerakey3 xe='-3.67394e-14' ye='300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-4.32978e-17' yquat='0.707107' zquat='0.707107' wquat='4.32978e-17' />
		<camerakey4 xe='-300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='0.5' zquat='0.5' wquat='0.5' />
		<camerakey5 xe='300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='-0.5' zquat='-0.5' wquat='0.5' />
		<camerakey6 xe='-173.205' ye='-173.205' ze='173.205' xt='0' yt='0' zt='0' xquat='-0.424708' yquat='0.17592' zquat='0.339851' wquat='0.820473' />
	</panel3d>
	<layout >
		<view type='0' name='GetHumidityFloat' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='100' scrollx='0' scrolly='29' flags='0' />
		<view type='0' name='DumpData' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='712' flags='0' />
		<view type='0' name='GetTempFloat' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='GetTempInt' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='pf' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Force_read' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='SetOversampling' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='ReadByte' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='SendBytes' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='ReadBytes' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='SendByte' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAArwIAAFIDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
