<root>
<document scada='0' schema='102' license='1,60868906,P8H31X' title='' description='' fcversion='590592' target='ESP.ESP32.ESP32_WROOM_32' >
	<config data='' clkspd='240000000' simspd='0' usewdt='0' constif='0' commport='3' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='1' head='typedef union
{ 
  MX_UINT16 AsUint[2]; 
  MX_UINT32 AsUlong;
} 
MX_Union_32;
MX_Union_32 convert;' body='' />
	<debug >
		<watch expr='Alarm' />
		<watch expr='Current' />
		<watch expr='Energy' />
		<watch expr='Frequency' />
		<watch expr='Power' />
		<watch expr='PowerFactor' />
		<watch expr='TempString' />
		<watch expr='Voltage' />
		<watch expr='ReadStats.Long' />
		<watch expr='ReadStats.Ret' />
		<watch expr='ReadStats.Val' />
	</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='1' />
			<data name='CalculatedCommsDelay' value='1' />
			<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='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='44996872-3874-4fc2-b63c-5e89dd415aa7' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' category2='' category3='' bIs2dOnly='0' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='1' scadaCompatible='0' embeddedCompatible='1' iconpath='' />
		<gdiopts FullContainer='1' FullTransparency='1' ShowGdi='1' ShowOpengl='1' />
		<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' comp2dType='0' >
			<resources />
			<properties >
				<property name='Keep Alive' target='KeepAlive' typeid='7' hidden='0' locked='0' info='' />
				<property name='Wi-Fi Router' folder='property_1' hidden='0' >
					<property name='SSID' target='SSID' typeid='10' hidden='0' locked='0' info='' />
					<property name='Password' target='Password' typeid='10' hidden='0' locked='0' info='' />
				</property>
			</properties>
			<values >
				<value target='KeepAlive' data='0' />
				<value target='SSID' data='' />
				<value target='Password' data='' />
			</values>
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='HH' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<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='TempString5' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='20' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TempString4' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='20' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TempString3' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='20' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Tempstring2' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='20' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='RetRTU' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TempString1' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='20' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TL' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TH' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='true' type='b1' description='' isconst='1' isHidden='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='HL' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='ReadTempModule' description='Reads the Temperature &amp; Humidity from the XY-MD02 module.

LED is just for diagnostics to show data is being processed.

!!!!!!!!!  Do not forget to reverse the decision box.' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<local name='Ret' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='Long' type='u32' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='HighUInt' type='u16' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='LowUInt' type='u16' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='ModbusMaster1' macro='ReadHoldingRegister' >
							<return exp='RetRTU' />
							<argument exp='1' />
							<argument exp='0' />
							<argument exp='2' />
						</command>
						<command class_type='decision' title='Command OK' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='RetRTU = 0' swap='1' >
							<flowline >
								<command class_type='output' title='Status LED' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' mode='1' port='4194304' mask='4' exp='1' usechipref='0' />
								<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='ModbusMaster1' macro='GetResponseByte' >
									<return exp='TH' />
									<argument exp='4' />
								</command>
								<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='ModbusMaster1' macro='GetResponseByte' >
									<return exp='TL' />
									<argument exp='5' />
								</command>
								<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='ModbusMaster1' macro='GetResponseByte' >
									<return exp='HH' />
									<argument exp='6' />
								</command>
								<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='ModbusMaster1' macro='GetResponseByte' >
									<return exp='HL' />
									<argument exp='7' />
								</command>
							</flowline>
							<flowline >
								<command class_type='output' title='Status LED' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' mode='1' port='4194304' mask='4' exp='0' usechipref='0' />
							</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='' />
						<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='ModbusMaster1' macro='Initialise' />
						<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='cal_uart1' macro='Init' />
						<command class_type='loop' title='Loop' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' type='0' exp='1' >
							<flowline >
								<command class_type='call' title='User Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' macro='ReadTempModule' />
								<command class_type='calculation' title='Calculation' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' >
									<exp exp='TempString1 = &quot;RetRTU=&quot; + toString$ (RetRTU) + &quot; \r&quot;' />
									<exp exp='TempString2 = &quot;TemperatureH=&quot; + ToString$ (TH) + &quot;\r&quot;' />
									<exp exp='TempString3 = &quot;TemperatureL=&quot; + ToString$ (TL) + &quot;\r&quot;' />
									<exp exp='TempString4 = &quot;HumidityH=&quot; + ToString$ (HH) + &quot;\r&quot;' />
									<exp exp='TempString5 = &quot;HumidityL=&quot; + ToString$ (HL) + &quot;\r&quot;' />
								</command>
								<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='cal_uart1' macro='SendString' >
									<argument exp='TempString1' />
								</command>
								<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='cal_uart1' macro='SendString' >
									<argument exp='Tempstring2' />
								</command>
								<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='cal_uart1' macro='SendString' >
									<argument exp='Tempstring3' />
								</command>
								<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='cal_uart1' macro='SendString' >
									<argument exp='Tempstring4' />
								</command>
								<command class_type='call' title='Component Macro' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' component='cal_uart1' macro='SendString' >
									<argument exp='Tempstring5' />
								</command>
								<command class_type='delay' title='Delay' cmdcolor='5767111' cmdcolor_sec='5767111' cmdcolor_txt='2105376' cmdgradient='1' cmdopacity='0.01' exp='500' type='1' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='47f6b39b-ead7-40f5-9931-8a79aa54014a' vmin='1' vmaj='2' codename='ModbusMaster1' x='16.4823' y='224.825' z='4.825' xsz='64' ysz='32' zsz='2.01' 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' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='cal_uart::CHANNEL' data='003' />
					<value target='cal_uart::TX' data='$PORTA.17' />
					<value target='cal_uart::OutputPins' data='023' />
					<value target='cal_uart::TXAlt' data='0' />
					<value target='cal_uart::RX' data='$PORTA.16' />
					<value target='cal_uart::InputPins' data='022' />
					<value target='cal_uart::RXAlt' data='0' />
					<value target='cal_uart::BAUD_LIST' data='004' />
					<value target='cal_uart::BAUD' data='9600' />
					<value target='UARTidx' data='003' />
					<value target='BaudByteDelay' data='1040' />
					<value target='BusType' data='001' />
					<value target='DDRP' data='$PORTA.21' />
					<value target='ReadDDRState' data='000' />
					<value target='FrameType' data='000' />
					<value target='ReceiveBufferSize' data='60' />
					<value target='AddressBytes' data='1' />
					<value target='SilentInterval' data='60' />
					<value target='RXTOUT' data='220' />
					<value target='TOUTCNT' data='2' />
					<value target='label' data='Modbus' />
					<value target='cal_uart::ScopeTraces' data='0' />
					<value target='cal_uart::ConsoleData' data='1' />
					<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' />
					<value target='cal_uart::APIUseDDR' data='' />
					<value target='cal_uart::APIDDRPin' data='' />
					<value target='cal_uart::APIDDRRXState' data='' />
					<value target='cal_uart::APIUseFC' data='' />
					<value target='cal_uart::APICTSPin' data='' />
					<value target='cal_uart::APIRTSPin' data='' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='f0f54e46-0848-4930-9bb6-eff9a34ed229' vmin='4' vmaj='2' codename='WLAN_ESP32' x='20.5' y='348.676' z='10.2796' xsz='2.95775' ysz='2.95775' zsz='2.95775' 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='1' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='Verbose' data='0' />
					<value target='RemapIndex' data='22' />
					<value target='TCP_Base1::interface' data='2' />
					<value target='TCP_Base1::ConsoleData' data='1' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='91b64b1d-b8b2-40f1-b073-e953a91fa234' vmin='2' vmaj='2' codename='cal_uart1' x='12.8998' y='100.794' z='-5692.23' xsz='70.4713' ysz='70.4713' zsz='70.4713' 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' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='UseUART' data='1' />
					<value target='CHANNEL' data='002' />
					<value target='UseTX' data='1' />
					<value target='TX' data='$PORTA.13' />
					<value target='OutputPins' data='011' />
					<value target='TXAlt' data='0' />
					<value target='UseRX' data='0' />
					<value target='RX' data='$PORTA.3' />
					<value target='InputPins' data='000' />
					<value target='RXAlt' data='0' />
					<value target='FLOWEN' data='000' />
					<value target='RTS' data='$PORTC.4' />
					<value target='CTS' data='$PORTC.5' />
					<value target='BAUD_LIST' data='009' />
					<value target='BAUD' data='115200' />
					<value target='DBITS' data='008' />
					<value target='RETURN' data='001' />
					<value target='ECHO' data='000' />
					<value target='INT' data='000' />
					<value target='ScopeTraces' data='1' />
					<value target='ConsoleData' data='1' />
					<value target='ConsoleFormat' data='000' />
					<value target='ConsoleColumns' data='64' />
					<value target='DataSource' data='000' />
					<value target='com_port' data='000' />
					<value target='Injector' data='' />
					<value target='InjectorHandle' data='0' />
					<value target='InjectorChannel' data='0' />
					<value target='APIUseDDR' data='0' />
					<value target='APIDDRPin' data='0' />
					<value target='APIUseFC' data='' />
					<value target='APICTSPin' data='0' />
					<value target='APIRTSPin' data='' />
					<value target='APIDDRRXState' data='000' />
					<value target='REF' data='0' />
					<value target='TX_PORT' data='$PORTA.13' />
					<value target='TX_TRIS' data='$PORTA.13' />
					<value target='TX_PIN' data='13' />
					<value target='RX_PORT' data='$PORTA.3' />
					<value target='RX_TRIS' data='$PORTA.3' />
					<value target='RX_PIN' data='3' />
					<value target='CTS_PORT' data='$PORTC.5' />
					<value target='CTS_PIN' data='5' />
					<value target='CTS_TRIS' data='$PORTC.5' />
					<value target='RTS_PORT' data='$PORTC.4' />
					<value target='RTS_PIN' data='4' />
					<value target='RTS_TRIS' data='$PORTC.4' />
					<value target='REMAPPABLE' data='1' />
					<value target='OutputReg' data='011' />
					<value target='InputReg' data='' />
					<value target='TXRPNUM' data='1' />
					<value target='TXBank' data='' />
					<value target='RXRPREG' data='' />
					<value target='RXBank' data='' />
					<value target='UARTName' data='' />
					<value target='UARTClock' data='' />
					<value target='UartNumber' data='' />
					<value target='TXBank2' data='' />
					<value target='RXBank2' data='' />
					<value target='TX_ALT' data='' />
					<value target='RX_ALT' data='' />
					<value target='BitDelay' data='8' />
					<value target='ParentName' data='panel' />
					<value target='CompName' data='' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<scadaresourcelookup />
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' >
		<background rgb='1710618' img='' style='0' />
		<camera xe='9.52567' ye='310.517' ze='577.709' xt='9.52567' yt='310.517' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<viewport dx='569' dy='826' zoom='119.176' fix_topleft='0' />
		<page x='1000' y='1000' show='0' rgb='0' />
	</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='506.303' ye='736.673' ze='2778.74' xt='506.303' yt='736.673' 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='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAJAYAAD4CAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='ReadTempModule' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAJAYAAD4CAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
