<root>
<document scada='0' schema='102' license='1,79829088,X1MNCF' title='' description='' fcversion='590080' target='ARD.ATMEGA.Arduino Uno R3 PDIP' >
	<config data='' clkspd='16000000' simspd='0' usewdt='0' constif='0' commport='4' 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='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='04c7fbcb-9ed4-4a80-aa24-e4b0a40a262b' 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='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='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 name='I2c addr (0..7)' target='offset' typeid='21' hidden='0' locked='0' info='' />
				</property>
				<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' />
			</properties>
			<values >
				<value target='cal_i2c1::CHANNEL' data='001' />
				<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='offset' data='1' />
				<value target='cal_i2c1::BAUD_LIST' data='002' />
			</values>
			<events />
			<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='disabled' type='u8' description='True if DAC is disabled' isconst='0' isHidden='0' isinit='1' usrinit='1' setinit='true' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='MCP7425' type='s16' description='i2c base address' isconst='1' isHidden='0' isinit='1' usrinit='96' setinit='0x60' />
				</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='SetPower' description='Set the current output of the DAC' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='power' type='u16' description='12 bit value (0..4095)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='data' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='3' />
						</local>
						<local name='len' type='u8' description='Length of command to write' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='calculation' title='Clamp power to 12 bits' cmdcolor='4198239' cmdcolor_sec='10777539' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' >
							<exp exp='.power = .power &amp; 0xfff' />
						</command>
						<command class_type='decision' title='Use 3 byte command to wake ' cmdcolor='1336547' cmdcolor_sec='7915775' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' exp='disabled' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' cmdcolor='4198239' cmdcolor_sec='10777539' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' >
									<exp exp='.data[0] = 0b01000000' />
									<exp exp='.data[1] = .power &gt;&gt; 4' />
									<exp exp='.data[2] = .power &lt;&lt; 4' />
									<exp exp='.len = 3' />
									<exp exp='disabled = false' />
								</command>
							</flowline>
							<flowline >
								<command class_type='calculation' title='Calculation' cmdcolor='4198239' cmdcolor_sec='10777539' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' >
									<exp exp='.data[0] = .power &gt;&gt; 8' />
									<exp exp='.data[1] = .power' />
									<exp exp='.len = 2' />
								</command>
							</flowline>
						</command>
						<command class_type='call' title='Component Macro' cmdcolor='1967002' cmdcolor_sec='8546302' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' component='cal_i2c1' macro='Transaction_Write' >
							<argument exp='.data' />
							<argument exp='.len' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Disable' description='Disable the DAC (power-down) and (optionally) write this data to the EEPROM so that this state is set on application of power' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<param name='power' type='u16' description='If resistance set to 0 applying power Vcc to DAC will set this as output' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='resistance' type='u8' description='0 = power on, 1 = 1K, 2 = 100K, 3 = 500K' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='write' type='b1' description='set to true to write value to eeprom (power on disabled)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='data' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='3' />
						</local>
						<command class_type='calculation' title='Calculation' cmdcolor='4198239' cmdcolor_sec='10777539' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' >
							<exp exp='.resistance = .resistance &amp; 0b11' />
							<exp exp='.data[0] = 0b01000000 | (.write &lt;&lt; 5) | (.resistance &lt;&lt; 1)' />
							<exp exp='.data[1] = .power &gt;&gt; 4' />
							<exp exp='.data[2] = .power &lt;&lt; 4' />
							<exp exp='disabled = .resistance != 0' />
						</command>
						<command class_type='call' title='Component Macro' cmdcolor='1967002' cmdcolor_sec='8546302' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' component='cal_i2c1' macro='Transaction_Write' >
							<argument exp='.data' />
							<argument exp='3' />
						</command>
						<command class_type='decision' title='If writing to eeprom - wait for completion' cmdcolor='1336547' cmdcolor_sec='7915775' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' exp='.write' swap='0' >
							<flowline >
								<command class_type='loop' title='Loop until &apos;complete&apos; flag set' cmdcolor='1336547' cmdcolor_sec='7915775' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' type='1' exp='.data[0] &amp; 0b10000000' start='0' >
									<flowline >
										<command class_type='call' title='Component Macro' cmdcolor='1967002' cmdcolor_sec='8546302' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' component='cal_i2c1' macro='Transaction_Read' >
											<argument exp='.data' />
											<argument exp='3' />
										</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='sin9' type='u16' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='{  2048, 2148, 2248, 2348, 2447, 2545, 2642, 2737,
  2831, 2923, 3013, 3100, 3185, 3267, 3346, 3423,
  3495, 3565, 3630, 3692, 3750, 3804, 3853, 3898,
  3939, 3975, 4007, 4034, 4056, 4073, 4085, 4093,
  4095, 4093, 4085, 4073, 4056, 4034, 4007, 3975,
  3939, 3898, 3853, 3804, 3750, 3692, 3630, 3565,
  3495, 3423, 3346, 3267, 3185, 3100, 3013, 2923,
  2831, 2737, 2642, 2545, 2447, 2348, 2248, 2148,
  2048, 1947, 1847, 1747, 1648, 1550, 1453, 1358,
  1264, 1172, 1082,  995,  910,  828,  749,  672,
   600,  530,  465,  403,  345,  291,  242,  197,
   156,  120,   88,   61,   39,   22,   10,    2,
     0,    2,   10,   22,   39,   61,   88,  120,
   156,  197,  242,  291,  345,  403,  465,  530,
   600,  672,  749,  828,  910,  995, 1082, 1172,
  1264, 1358, 1453, 1550, 1648, 1747, 1847, 1947}' >
							<array size='512' />
						</local>
						<local name='i' type='u16' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<local name='p' type='u16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' cmdcolor='1967002' cmdcolor_sec='8546302' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' macro='Initialise' />
						<command class_type='delay' title='Delay' cmdcolor='4198239' cmdcolor_sec='10777539' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' exp='1' type='2' />
						<command class_type='loop' title='Loop' cmdcolor='1336547' cmdcolor_sec='7915775' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' type='2' exp='10000' >
							<flowline >
								<command class_type='call' title='User Macro' cmdcolor='1967002' cmdcolor_sec='8546302' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' macro='SetPower' >
									<argument exp='.sin9[.i]' />
								</command>
								<command class_type='calculation' title='Calculation' cmdcolor='4198239' cmdcolor_sec='10777539' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' >
									<exp exp='.i = (.i + 1) % 128' />
								</command>
							</flowline>
						</command>
						<command class_type='call' title='User Macro' cmdcolor='1967002' cmdcolor_sec='8546302' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' macro='Disable' >
							<argument exp='1024' />
							<argument exp='0' />
							<argument exp='1' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Initialise' description='Initialise DAC - return true is DAC found.' statediag='0' >
						<return name='Return' type='b1' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='Component Macro' cmdcolor='1967002' cmdcolor_sec='8546302' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' component='cal_i2c1' macro='Transaction_Initialise' >
							<argument exp='MCP7425 | offset' />
						</command>
						<command class_type='calculation' title='Force wake up on first SetPower' cmdcolor='4198239' cmdcolor_sec='10777539' cmdcolor_txt='16777215' cmdgradient='2' cmdopacity='1' >
							<exp exp='disabled = true' />
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='ed3a5141-43bb-43e0-86b0-2243fd1147ca' vmin='0' 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' 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='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='InjectorChannel' 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='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='15780518' img='' style='0' />
		<camera xe='0' ye='0' ze='842.16' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<viewport dx='696' dy='669' zoom='100' fix_topleft='0' />
		<page x='1000' y='1000' show='0' rgb='7360576' />
	</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' />
	</panel3d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAhgQAADkDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Initialise' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAhgQAADkDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='SetPower' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAhgQAADkDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Disable' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAAhgQAADkDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
