<root>
<document schema='101' license='1,407charles,AUQQUZ' title='' description='' target='AVR.ATMEGA.Arduino Uno R3 SMD' >
	<config data='' clkspd='16000000' simspd='1' usewdt='0' constif='0' />
	<plugins >
		<dll_dbg_icd enabled='0' >
			<data name='debug' value='1' />
			<data name='userpins' value='0' />
			<data name='speed' value='1000' />
			<data name='usev9' value='0' />
			<data name='breaks' value='8' />
			<data name='stacks' value='8' />
			<data name='clkport' value='1' />
			<data name='clkbit' value='6' />
			<data name='dataport' value='1' />
			<data name='databit' value='7' />
			<data name='ghostype' value='0' />
			<data name='monitor' value='1' />
			<data name='ictloop' value='1' />
			<data name='ictrate' value='1000' />
			<data name='ictmask' value='-1' />
			<data name='anlpres' value='255' />
			<data name='digmask1' value='-1' />
			<data name='digmask2' value='-1' />
		</dll_dbg_icd>
		<dll_models enabled='1' />
		<dll_upgrader enabled='1' />
		<dll_webhelp enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug />
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='0' 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' interactive='1' solid='1' layer='0' poslock='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='PASSTIMElow' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='PASSTIME' type='s16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='PASSTIMEhigh' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='Main' description='' >
						<command class_type='call' title='' component='lcd_eb005' macro='Start' />
						<command class_type='call' title='' component='lcd_eb005' macro='Cursor' >
							<argument exp='0' />
							<argument exp='0' />
						</command>
						<command class_type='call' title='' component='lcd_eb005' macro='PrintString' >
							<argument exp='&quot;Elapsed time:&quot;' />
						</command>
						<command class_type='native' title='Set registers' ccode='// set TCCR1B to capture mode, filtered with not preescaling, every rising edge  
TCCR1B = 11000000;

// enable the Capture mode in the mask register
TIMSK1 = 00100000;

// set the comparator to trigger the ICP1 pin
ACSR = 11000100;

' language='C' />
						<command class_type='delay' title='Delay' exp='1' type='1' />
						<command class_type='loop' title='Loop forever' type='0' exp='1' >
							<flowline >
								<command class_type='native' title='Execute capture' ccode='//  clear the counter 
TCNT1H = 0;
TCNT1L = 0;

// reset the capture flag ccp1if
TIFR1 &amp;= 0xEF; //TIFR1.5 = 0;

//  wait for the first capture to take place 
//while (TIFR1.5 == 0);
while (TIFR1 &amp; 0x10 == 0);

// start the capture and clear the capture flag
//TCCR1B.0 = 1;
//TIFR1.5 = 0;
TCCR1B |= 1;
TIFR1 &amp;= 0xEF;

//  wait for the next capture  
//while (TIFR1.5 == 0);
while (TIFR1 &amp; 0x10 == 0);

//  stop the timer and record the value  
//TCCR1B.0 = 0;
TCCR1B &amp;= 0xFE;
FCV_PASSTIMELOW = ICR1L;
FCV_PASSTIMEHIGH = ICR1H;



' language='C' />
								<command class_type='calculation' title='' >
									<exp exp='PASSTIME = PASSTIMElow + 256 * PASSTIMEhigh' />
								</command>
								<command class_type='call' title='' component='lcd_eb005' macro='Cursor' >
									<argument exp='0' />
									<argument exp='1' />
								</command>
								<command class_type='call' title='Display elapsed time' component='lcd_eb005' macro='PrintNumber' >
									<argument exp='PASSTIME' />
								</command>
								<command class_type='call' title='' component='lcd_eb005' macro='PrintString' >
									<argument exp='&quot; counts.         &quot;' />
								</command>
								<command class_type='delay' title='Delay so you can read the LCD' exp='2' type='2' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='0953aac0-9c23-4c2f-9843-88954a4191ea' vmin='1' vmaj='2' codename='v5__lcddisplay0' x='0' y='0' z='0' xsz='78.2857' ysz='13.1429' zsz='1.14286' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='LCD_Mode' data='000' />
					<value target='Pin_Data_0' data='$PORTB.0' />
					<value target='Pin_Data_1' data='$PORTB.1' />
					<value target='Pin_Data_2' data='$PORTB.2' />
					<value target='Pin_Data_3' data='$PORTB.3' />
					<value target='Pin_Data_4' data='$PORTA.1' />
					<value target='Pin_Data_5' data='$PORTA.1' />
					<value target='Pin_Data_6' data='$PORTA.1' />
					<value target='Pin_Data_7' data='$PORTA.1' />
					<value target='LCD_Port' data='$PORTA' />
					<value target='Pin_RS' data='$PORTB.4' />
					<value target='Pin_E' data='$PORTB.5' />
					<value target='LCD_Use_Write' data='0' />
					<value target='Pin_RW' data='$PORTA.0' />
					<value target='Rows' data='2' />
					<value target='Columns' data='16' />
					<value target='BackgroundColor' data='0x808080' />
					<value target='LineColor' data='0' />
					<value target='TextColor' data='0x000000' />
					<value target='Font' data='Arial' />
					<value target='CursorPosX' data='11' />
					<value target='CursorPosY' data='0' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='d29dda88-17de-4008-991a-c881890d4c57' vmin='1' vmaj='1' codename='lcd_eb005' x='0' y='0' z='3.575' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='Pin_Data_0' data='$PORTD.2' />
					<value target='Pin_Data_1' data='$PORTD.3' />
					<value target='Pin_Data_2' data='$PORTD.4' />
					<value target='Pin_Data_3' data='$PORTD.5' />
					<value target='Pin_RS' data='$PORTD.6' />
					<value target='Pin_E' data='$PORTD.7' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' perspective='0' >
		<background rgb='9737364' 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='0' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='25' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel3d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAAGgQAAFkCAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
