<root>
<document scada='0' projtype='1' schema='103' license='1,79829088,Q2XNNM' title='New Embedded Project' description='' fcversion='720896' target='ARD.ATMEGA.Arduino Uno R3 PDIP' >
	<config data='' clkspd='16000000' simspd='0' usewdt='0' constif='0' 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='3' />
			<data name='ClockPin' value='1' />
			<data name='DataPort' value='3' />
			<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='0' center='1' unitscale='0' fixedscale='0' fixedx='25' fixedy='25' fixedz='25' headcode='0' />
		<definition guid='2f06a8a9-0970-427d-9d61-d723f666012d' vstate='40' vmin='0' vmaj='1' srcleaf='DS3231Temp.fcfx' visiblename='DS3231TempSensor' description='Read the DS3231 temperature sensor - this is updated every 64 seconds' category='Development' category2='' category3='' bIs2dOnly='0' bIs3dOnly='0' bIsWysiwyg='0' catenable='1' author='M Fisher' manuname='' manucode='' sysinfo='779' keywords='' dynamic='1' scadaCompatible='0' embeddedCompatible='1' showmacros='1' iconpath='' />
		<component class_type='root' codename='DS3231TempSensor' 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='DS3231 Address' target='addr' typeid='21' hidden='0' locked='0' hexview='1' info='' />
				<property name='Connections' folder='cal_i2c1::property_2' hidden='0' >
					<property name='Channel' target='cal_i2c1::CHANNEL' typeid='16' hidden='0' locked='0' info='Channel selection' filter='000Software
001Channel 1
' />
					<property name='Mode' target='cal_i2c1::Mode' typeid='16' hidden='0' locked='0' info='Defines if the component will be used for Master or Slave communications.

Master mode supports a software bitbanged I2C channel.
Slave mode requires a hardware I2C peripheral to catch the communications from the Master.' filter='000Master
001Slave' />
					<property name='SDA' target='cal_i2c1::SDA' typeid='5' hidden='0' locked='1' info='Pin used for SDA (data signal)' />
					<property name='SDA Remap Pin' target='cal_i2c1::SDAPins' typeid='16' hidden='1' locked='0' info='' filter='000$PORTC.0
001$PORTC.1
002$PORTC.2
003$PORTC.3
004$PORTC.4
005$PORTC.5
006$PORTC.6
007$PORTC.7
008$PORTB.0
009$PORTB.1
010$PORTB.2
011$PORTB.3
012$PORTB.4
013$PORTB.5
014$PORTB.6
015$PORTB.7' />
					<property name='SCL' target='cal_i2c1::SCL' typeid='5' hidden='0' locked='1' info='Pin used for SCL (clock signal)' />
					<property name='SCL Remap Pin' target='cal_i2c1::SCLPins' typeid='16' hidden='1' locked='0' info='' filter='000$PORTC.0
001$PORTC.1
002$PORTC.2
003$PORTC.3
004$PORTC.4
005$PORTC.5
006$PORTC.6
007$PORTC.7
008$PORTB.0
009$PORTB.1
010$PORTB.2
011$PORTB.3
012$PORTB.4
013$PORTB.5
014$PORTB.6
015$PORTB.7' />
				</property>
				<property name='Options' folder='cal_i2c1::property_3' hidden='0' >
					<property name='Stop Delay' target='cal_i2c1::StopDel' typeid='7' hidden='0' locked='0' info='On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not 
a 10ms delay between an I2C stop event and the next I2C start event.

Most modern microcontrollers will not have a problem so this property can be disabled to speed up the 
I2C communications. ' />
					<property name='Baud Select' target='cal_i2c1::BAUD_LIST' typeid='16' hidden='0' locked='0' info='Baud rate option selector' filter='000Custom
001100KHz
002400KHz
0031MHz' />
					<property name='Baud Rate' target='cal_i2c1::BAUD' typeid='14' hidden='0' locked='1' info='Baud rate to be used' />
					<property name='Slew Rate Control' target='cal_i2c1::SRC' typeid='16' hidden='0' locked='0' info='Slew Rate Control Enabled or Disabled' filter='000Disabled
001Enabled' />
					<property name='SMBus Inputs' target='cal_i2c1::SMB' typeid='16' hidden='0' locked='0' info=' When Enabled input logic thresholds are compliant with SMBus specification' filter='000Disabled
001Enabled' />
					<property name='Clock Stretching' target='cal_i2c1::ClockStretching' typeid='7' hidden='1' locked='0' info='Allows the clock signal to be stretched to help combat high capacitance on the SCL/SDA bus signals.
When setting the clock high the CAL code will wait for the clock to read as a high before continuing.
Can potentially cause lockups if pull up resistors are missing from the SDA / SCL signals.
Only compatible with Software I2C channels. ' />
				</property>
			</properties>
			<values >
				<value target='addr' data='104' />
				<value target='cal_i2c1::CHANNEL' data='001' />
				<value target='cal_i2c1::Mode' data='000' />
				<value target='cal_i2c1::SDA' data='$PORTC.4' />
				<value target='cal_i2c1::SDAPins' data='000' />
				<value target='cal_i2c1::SCL' data='$PORTC.5' />
				<value target='cal_i2c1::SCLPins' data='001' />
				<value target='cal_i2c1::StopDel' data='0' />
				<value target='cal_i2c1::BAUD_LIST' data='001' />
				<value target='cal_i2c1::BAUD' data='100000' />
				<value target='cal_i2c1::SRC' data='000' />
				<value target='cal_i2c1::SMB' data='000' />
				<value target='cal_i2c1::ClockStretching' data='1' />
			</values>
			<events />
			<apis >
				<api name='SetMinuteAlarm' alt='SetMinuteAlarm' type='1' proto='1' />
				<api name='ResetAlarm' alt='ResetAlarm' type='1' proto='1' />
				<api name='GetTemp' alt='GetTemp' 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='init' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='1' setinit='true' />
				</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='SetMinuteAlarm' description='Set the alarm to signal every minute' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<local name='buf' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='&quot; 7,0, 0x80, 0x80, 0x80 &quot;' setinit='{7,0, 0x80, 0x80, 0x80}' >
							<array size='5' />
						</local>
						<local name='intcn' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Initialise' >
							<argument exp='addr' />
						</command>
						<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Write' >
							<argument exp='.buf' />
							<argument exp='5' />
						</command>
						<command class_type='call' title='User Macro' macro='GetReg' >
							<return exp='.intcn' />
							<argument exp='0x0E' />
						</command>
						<command class_type='calculation' title='Set INTCN and A1IE' >
							<exp exp='.buf[0] = 0x0E' />
							<exp exp='.buf[1] = .intcn | 0x05' />
						</command>
						<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Write' >
							<argument exp='.buf' />
							<argument exp='2' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='ResetAlarm' description='Clears an alarm flag if set' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<local name='buf' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='2' />
						</local>
						<local name='status' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='GetReg' >
							<return exp='.status' />
							<argument exp='0x0F' />
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.buf[0] = 0x0F' />
							<exp exp='.buf[1] = .status &amp; 0b1111100' />
						</command>
						<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Write' >
							<argument exp='.buf' />
							<argument exp='2' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='GetReg' description='' statediag='0' >
						<return name='Return' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='reg' 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='1' />
						</local>
						<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Initialise' >
							<argument exp='addr' />
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.buf[0] = .reg' />
						</command>
						<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Write' >
							<argument exp='.buf' />
							<argument exp='1' />
						</command>
						<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Read' >
							<argument exp='.buf' />
							<argument exp='1' />
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.Return = .buf[0]' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='GetTemp' description='' statediag='0' >
						<return name='Return' type='f32' description='' isconst='0' isHidden='0' isinit='0' usrinit='0.0' setinit='' />
						<local name='data' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='&quot; 0x11 &quot;' setinit='{0x11}' >
							<array size='2' />
						</local>
						<local name='temp' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='temp_frac' type='f32' description='' isconst='0' isHidden='0' isinit='1' usrinit='0.0' setinit='0' />
						<command class_type='decision' title='Decision' exp='init' swap='0' >
							<flowline >
								<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Initialise' >
									<argument exp='addr' />
								</command>
								<command class_type='calculation' title='Calculation' >
									<exp exp='init = false' />
								</command>
							</flowline>
							<flowline />
						</command>
						<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Write' >
							<argument exp='.data' />
							<argument exp='1' />
						</command>
						<command class_type='call' title='Component Macro' component='cal_i2c1' macro='Transaction_Read' >
							<argument exp='.data' />
							<argument exp='2' />
						</command>
						<command class_type='decision' title='Decision' exp='.data[0] &amp; 0x80' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='.temp = ~((~.data[0] &amp; 0xFF) + 1)' />
								</command>
							</flowline>
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='.temp = .data[0]' />
								</command>
							</flowline>
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='.temp_frac = (.data[1] &gt;&gt; 6) * 0.25' />
							<exp exp='.Return = .temp + .temp_frac' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='ed3a5141-43bb-43e0-86b0-2243fd1147ca' vmin='0' vmaj='2' codename='cal_i2c1' panelId='0' x='123' y='-116' z='0' xsz='25.1778' ysz='25' 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='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='001' />
					<value target='StopDel' data='0' />
					<value target='BAUD_LIST' data='001' />
					<value target='BAUD' data='100000' />
					<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.3' />
					<value target='SCL_TRIS' data='$PORTC.3' />
					<value target='SCL_PIN' data='3' />
					<value target='MASTER' data='1' />
					<value target='ScopeTraces' data='0' />
					<value target='ConsoleData' data='1' />
					<value target='Injector' data='000' />
					<value target='InjectorHandle' data='0' />
					<value target='InjectorChannel' data='0' />
					<value target='Loading' data='1' />
					<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='10' />
					<value target='SDAAlts' data='000' />
					<value target='SCLAlts' data='000' />
					<value target='SDAAlt' data='0' />
					<value target='SCLAlt' data='0' />
				</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='2781.16' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<viewport dx='473' dy='1700' zoom='20.5788' fix_topleft='0' />
		<page x='1000' y='1000' show='0' rgb='7360576' />
		<winpos ID='7005' RectRecentFloat='1270,427,1920,877' RectRecentDocked='0,0,473,1741' 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='0' />
		<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='492,473,1146,1050' RectRecentDocked='0,0,642,397' 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='1218,511,1868,961' RectRecentDocked='2729,286,3371,2027' 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='400' disp_col='16777215' />
		</panel2d_0>
	</panels2d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAAAMAAMIGAAA' zoom='140' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='GetTemp' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAAAMAAMIGAAA' zoom='135' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='ResetAlarm' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAAAMAAMIGAAA' zoom='135' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='GetReg' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAAAMAAMIGAAA' zoom='125' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='SetMinuteAlarm' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAqAAAAAAMAAMIGAAA' zoom='150' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
