
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://combustory.com/wiki/skins/common/feed.css?301"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://combustory.com/wiki/index.php?action=history&amp;feed=atom&amp;title=The_MPGuino_-_Arduino_Code</id>
		<title>The MPGuino - Arduino Code - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://combustory.com/wiki/index.php?action=history&amp;feed=atom&amp;title=The_MPGuino_-_Arduino_Code"/>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;action=history"/>
		<updated>2026-04-04T07:57:59Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.17.0</generator>

	<entry>
		<id>http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=519&amp;oldid=prev</id>
		<title>Jvaughters at 01:13, 8 October 2009</title>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=519&amp;oldid=prev"/>
				<updated>2009-10-08T01:13:02Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 01:13, 8 October 2009&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;anyweb&amp;gt;http://combustory.com/wiki/ads/ad_rtc.html&amp;lt;/anyweb&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jvaughters</name></author>	</entry>

	<entry>
		<id>http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=353&amp;oldid=prev</id>
		<title>Combustor: /* MPGuino.pde Code v.701 */</title>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=353&amp;oldid=prev"/>
				<updated>2008-09-10T14:50:32Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;MPGuino.pde Code v.701&lt;/span&gt;&lt;/p&gt;
&lt;a href=&quot;http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;amp;diff=353&amp;amp;oldid=352&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Combustor</name></author>	</entry>

	<entry>
		<id>http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=352&amp;oldid=prev</id>
		<title>Combustor: /* MPGuino.pde Code v.7 */</title>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=352&amp;oldid=prev"/>
				<updated>2008-09-10T14:49:55Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;MPGuino.pde Code v.7&lt;/span&gt;&lt;/p&gt;
&lt;a href=&quot;http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;amp;diff=352&amp;amp;oldid=349&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Combustor</name></author>	</entry>

	<entry>
		<id>http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=349&amp;oldid=prev</id>
		<title>Combustor: The Arduino Code moved to The MPGuino - Arduino Code</title>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=349&amp;oldid=prev"/>
				<updated>2008-09-10T14:48:08Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;a href=&quot;/wiki/index.php/The_Arduino_Code&quot; class=&quot;mw-redirect&quot; title=&quot;The Arduino Code&quot;&gt;The Arduino Code&lt;/a&gt; moved to &lt;a href=&quot;/wiki/index.php/The_MPGuino_-_Arduino_Code&quot; title=&quot;The MPGuino - Arduino Code&quot;&gt;The MPGuino - Arduino Code&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:48, 10 September 2008&lt;/td&gt;
		&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Combustor</name></author>	</entry>

	<entry>
		<id>http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=312&amp;oldid=prev</id>
		<title>Combustor at 14:43, 25 August 2008</title>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=312&amp;oldid=prev"/>
				<updated>2008-08-25T14:43:04Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:43, 25 August 2008&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;minus;&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== MPGuino.pde Code ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''Check here for any updates http://opengauge.googlecode.com/svn/trunk/mpguino/mpguino.pde'''&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== MPGuino.pde Code &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;v.7 &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Combustor</name></author>	</entry>

	<entry>
		<id>http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=310&amp;oldid=prev</id>
		<title>Combustor at 14:40, 25 August 2008</title>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=310&amp;oldid=prev"/>
				<updated>2008-08-25T14:40:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:40, 25 August 2008&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;== MPGuino.pde Code ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;minus;&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define ver=700&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define ver=700&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1,098:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1,099:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;minus;&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Combustor</name></author>	</entry>

	<entry>
		<id>http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=309&amp;oldid=prev</id>
		<title>Combustor at 14:34, 25 August 2008</title>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=309&amp;oldid=prev"/>
				<updated>2008-08-25T14:34:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:34, 25 August 2008&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;minus;&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;nowiki&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define ver=700&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define ver=700&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1,095:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1,097:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;	TIMSK0&amp;amp;=!(1&amp;lt;&amp;lt;TOIE0);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;	TIMSK0&amp;amp;=!(1&amp;lt;&amp;lt;TOIE0);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;minus;&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/nowiki&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Combustor</name></author>	</entry>

	<entry>
		<id>http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=308&amp;oldid=prev</id>
		<title>Combustor at 14:33, 25 August 2008</title>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=308&amp;oldid=prev"/>
				<updated>2008-08-25T14:33:52Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:33, 25 August 2008&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;nowiki&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define ver=700&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define ver=700&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;/*&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1,094:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1,095:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;	TIMSK0&amp;amp;=!(1&amp;lt;&amp;lt;TOIE0);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;	TIMSK0&amp;amp;=!(1&amp;lt;&amp;lt;TOIE0);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/nowiki&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{default}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Combustor</name></author>	</entry>

	<entry>
		<id>http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=307&amp;oldid=prev</id>
		<title>Combustor: New page: {{default}} #define ver=700 /*  */ //GPL Software     //#define debuguino youbetyourbippy   #include &lt;avr/pgmspace.h&gt;   byte brightness[]={0,42,85,128}; //middle button cycles through thes...</title>
		<link rel="alternate" type="text/html" href="http://combustory.com/wiki/index.php?title=The_MPGuino_-_Arduino_Code&amp;diff=307&amp;oldid=prev"/>
				<updated>2008-08-25T14:33:02Z</updated>
		
		<summary type="html">&lt;p&gt;New page: {{default}} #define ver=700 &lt;span class=&quot;autocomment&quot;&gt;- : &lt;/span&gt; //GPL Software     //#define debuguino youbetyourbippy   #include &amp;lt;avr/pgmspace.h&amp;gt;   byte brightness[]={0,42,85,128}; //middle button cycles through thes...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{default}}&lt;br /&gt;
#define ver=700&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
//GPL Software    &lt;br /&gt;
//#define debuguino youbetyourbippy  &lt;br /&gt;
#include &amp;lt;avr/pgmspace.h&amp;gt;  &lt;br /&gt;
byte brightness[]={0,42,85,128}; //middle button cycles through these brightness settings      &lt;br /&gt;
#define brightnessLength (sizeof(brightness)/sizeof(byte)) //array size      &lt;br /&gt;
byte brightnessIdx=1;      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#define contrastIdx 0  //do contrast first to get display dialed in&lt;br /&gt;
#define vssPulsesPerMileIdx 1&lt;br /&gt;
#define microSecondsPerGallonIdx 2&lt;br /&gt;
#define injPulsesPer2Revolutions 3&lt;br /&gt;
#define currentTripResetTimeoutUSIdx 4&lt;br /&gt;
#define tankSizeIdx 5 &lt;br /&gt;
#define injectorSettleTimeIdx 6&lt;br /&gt;
#define weightIdx 7&lt;br /&gt;
#define scratchpadIdx 8&lt;br /&gt;
char *  parmLabels[]={&amp;quot;Contrast&amp;quot;,&amp;quot;VSS Pulses/Mile&amp;quot;, &amp;quot;MicroSec/Gallon&amp;quot;,&amp;quot;Pulses/2 revs&amp;quot;,&amp;quot;Timout(microSec)&amp;quot;,&amp;quot;Tank Gal * 1000&amp;quot;,&amp;quot;Injector DelayuS&amp;quot;,&amp;quot;Weight (lbs)&amp;quot;,&amp;quot;scratchpad(odo?)&amp;quot;};&lt;br /&gt;
//unsigned long  parms[]={15ul,16408ul,684968626ul,3ul,420000000ul,13300ul,500ul};//default values&lt;br /&gt;
unsigned long  parms[]={15ul,10000ul,304409714ul,4ul,420000000ul,13300ul,500ul,2400ul,0ul,};//default values&lt;br /&gt;
#define parmsLength (sizeof(parms)/sizeof(unsigned long)) //array size      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
#define guinosig B10100101&lt;br /&gt;
#include &amp;lt;EEPROM.h&amp;gt;&lt;br /&gt;
//Vehicle Interface Pins      &lt;br /&gt;
#define InjectorOpenPin 2      &lt;br /&gt;
#define InjectorClosedPin 3      &lt;br /&gt;
#define VSSPin 14 //analog 0      &lt;br /&gt;
 &lt;br /&gt;
//LCD Pins      &lt;br /&gt;
#define DIPin 4 // register select RS      &lt;br /&gt;
#define DB4Pin 7       &lt;br /&gt;
#define DB5Pin 8       &lt;br /&gt;
#define DB6Pin 12       &lt;br /&gt;
#define DB7Pin 13      &lt;br /&gt;
#define ContrastPin 6      &lt;br /&gt;
#define EnablePin 5       &lt;br /&gt;
#define BrightnessPin 9      &lt;br /&gt;
 &lt;br /&gt;
#define lbuttonPin 17 // Left Button, on analog 3,        &lt;br /&gt;
#define mbuttonPin 18 // Middle Button, on analog 4       &lt;br /&gt;
#define rbuttonPin 19 // Right Button, on analog 5       &lt;br /&gt;
 &lt;br /&gt;
#define vssBit 1     //  pin14 is a bitmask 1 on port C        &lt;br /&gt;
#define lbuttonBit 8 //  pin17 is a bitmask 8 on port C        &lt;br /&gt;
#define mbuttonBit 16 // pin18 is a bitmask 16 on port C        &lt;br /&gt;
#define rbuttonBit 32 // pin19 is a bitmask 32 on port C        &lt;br /&gt;
#define loopsPerSecond 2 // how many times will we try and loop in a second     &lt;br /&gt;
&lt;br /&gt;
typedef void (* pFunc)(void);//type for display function pointers      &lt;br /&gt;
&lt;br /&gt;
volatile unsigned long timer2_overflow_count;&lt;br /&gt;
&lt;br /&gt;
/*** Set up the Events ***&lt;br /&gt;
We have our own ISR for timer2 which gets called about once a millisecond.&lt;br /&gt;
So we define certain event functions that we can schedule by calling addEvent&lt;br /&gt;
with the event ID and the number of milliseconds to wait before calling the event. &lt;br /&gt;
The milliseconds is approximate.&lt;br /&gt;
&lt;br /&gt;
Keep the event functions SMALL!!!  This is an interrupt!&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
//event functions&lt;br /&gt;
&lt;br /&gt;
void enableLButton(){PCMSK1 |= (1 &amp;lt;&amp;lt; PCINT11);}&lt;br /&gt;
void enableMButton(){PCMSK1 |= (1 &amp;lt;&amp;lt; PCINT12);}&lt;br /&gt;
void enableRButton(){PCMSK1 |= (1 &amp;lt;&amp;lt; PCINT13);}&lt;br /&gt;
//array of the event functions&lt;br /&gt;
pFunc eventFuncs[] ={enableVSS, enableLButton,enableMButton,enableRButton};&lt;br /&gt;
#define eventFuncSize (sizeof(eventFuncs)/sizeof(pFunc)) &lt;br /&gt;
//define the event IDs&lt;br /&gt;
#define enableVSSID 0&lt;br /&gt;
#define enableLButtonID 1&lt;br /&gt;
#define enableMButtonID 2&lt;br /&gt;
#define enableRButtonID 3&lt;br /&gt;
//ms counters&lt;br /&gt;
unsigned int eventFuncCounts[eventFuncSize];&lt;br /&gt;
&lt;br /&gt;
//schedule an event to occur ms milliseconds from now&lt;br /&gt;
void addEvent(byte eventID, unsigned int ms){&lt;br /&gt;
  eventFuncCounts[eventID]=ms;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* this ISR gets called every 1.024 milliseconds, we will call that a millisecond for our purposes&lt;br /&gt;
go through all the event counts, &lt;br /&gt;
  if any are non zero subtract 1 and call the associated function if it just turned zero.  */&lt;br /&gt;
ISR(TIMER2_OVF_vect){&lt;br /&gt;
  timer2_overflow_count++;&lt;br /&gt;
  for(byte eventID = 0; eventID &amp;lt; eventFuncSize; eventID++){&lt;br /&gt;
    if(eventFuncCounts[eventID]!= 0){&lt;br /&gt;
      eventFuncCounts[eventID]--;&lt;br /&gt;
      if(eventFuncCounts[eventID] == 0)&lt;br /&gt;
          eventFuncs[eventID](); &lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
unsigned long maxLoopLength = 0; //see if we are overutilizing the CPU      &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
#define buttonsUp   lbuttonBit + mbuttonBit + rbuttonBit  // start with the buttons in the right state      &lt;br /&gt;
byte buttonState = buttonsUp;      &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//overflow counter used by millis2()      &lt;br /&gt;
unsigned long lastMicroSeconds=millis2() * 1000;   &lt;br /&gt;
unsigned long microSeconds (void){     &lt;br /&gt;
  unsigned long tmp_timer2_overflow_count;    &lt;br /&gt;
  unsigned long tmp;    &lt;br /&gt;
  byte tmp_tcnt2;    &lt;br /&gt;
  cli(); //disable interrupts    &lt;br /&gt;
  tmp_timer2_overflow_count = timer2_overflow_count;    &lt;br /&gt;
  tmp_tcnt2 = TCNT2;    &lt;br /&gt;
  sei(); // enable interrupts    &lt;br /&gt;
  tmp = ((tmp_timer2_overflow_count &amp;lt;&amp;lt; 8) + tmp_tcnt2) * 4;     &lt;br /&gt;
  if((tmp&amp;lt;=lastMicroSeconds) &amp;amp;&amp;amp; (lastMicroSeconds&amp;lt;4290560000ul))    &lt;br /&gt;
    return microSeconds();     &lt;br /&gt;
  lastMicroSeconds=tmp;   &lt;br /&gt;
  return tmp;     &lt;br /&gt;
}    &lt;br /&gt;
 &lt;br /&gt;
unsigned long elapsedMicroseconds(unsigned long startMicroSeconds, unsigned long currentMicroseconds ){      &lt;br /&gt;
  if(currentMicroseconds &amp;gt;= startMicroSeconds)      &lt;br /&gt;
    return currentMicroseconds-startMicroSeconds;      &lt;br /&gt;
  return 4294967295 - (startMicroSeconds-currentMicroseconds);      &lt;br /&gt;
}      &lt;br /&gt;
&lt;br /&gt;
unsigned long elapsedMicroseconds(unsigned long startMicroSeconds ){      &lt;br /&gt;
  return elapsedMicroseconds(startMicroSeconds, microSeconds());&lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
//Trip prototype      &lt;br /&gt;
class Trip{      &lt;br /&gt;
public:      &lt;br /&gt;
  unsigned long loopCount; //how long has this trip been running      &lt;br /&gt;
  unsigned long injPulses; //rpm      &lt;br /&gt;
  unsigned long injHiSec;// seconds the injector has been open      &lt;br /&gt;
  unsigned long injHius;// microseconds, fractional part of the injectors open       &lt;br /&gt;
  unsigned long vssPulses;//from the speedo      &lt;br /&gt;
  //these functions actually return in thousandths,       &lt;br /&gt;
  unsigned long miles();        &lt;br /&gt;
  unsigned long gallons();      &lt;br /&gt;
  unsigned long mpg();        &lt;br /&gt;
  unsigned long mph();        &lt;br /&gt;
  unsigned long time(); //mmm.ss        &lt;br /&gt;
  void update(Trip t);      &lt;br /&gt;
  void reset();      &lt;br /&gt;
  Trip();      &lt;br /&gt;
};      &lt;br /&gt;
 &lt;br /&gt;
//LCD prototype      &lt;br /&gt;
namespace LCD{      &lt;br /&gt;
  void gotoXY(byte x, byte y);      &lt;br /&gt;
  void print(char * string);      &lt;br /&gt;
  void init();      &lt;br /&gt;
  void tickleEnable();      &lt;br /&gt;
  void cmdWriteSet();      &lt;br /&gt;
  void LcdCommandWrite(byte value);      &lt;br /&gt;
  void LcdDataWrite(byte value);      &lt;br /&gt;
  byte pushNibble(byte value);      &lt;br /&gt;
};      &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//main objects we will be working with:      &lt;br /&gt;
unsigned long injHiStart; //for timing injector pulses      &lt;br /&gt;
Trip tmpTrip;      &lt;br /&gt;
Trip instant;      &lt;br /&gt;
Trip current;      &lt;br /&gt;
Trip tank;      &lt;br /&gt;
 &lt;br /&gt;
void processInjOpen(void){      &lt;br /&gt;
  injHiStart = microSeconds();      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
void processInjClosed(void){      &lt;br /&gt;
  long x = elapsedMicroseconds(injHiStart)- parms[injectorSettleTimeIdx];       &lt;br /&gt;
  if(x &amp;gt;0)&lt;br /&gt;
    tmpTrip.injHius += x;       &lt;br /&gt;
  tmpTrip.injPulses++;      &lt;br /&gt;
}      &lt;br /&gt;
&lt;br /&gt;
volatile boolean vssFlop = 0;&lt;br /&gt;
&lt;br /&gt;
void enableVSS(){&lt;br /&gt;
    tmpTrip.vssPulses++; &lt;br /&gt;
    vssFlop = !vssFlop;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
unsigned volatile long lastVSS1;&lt;br /&gt;
unsigned volatile long lastVSSTime;&lt;br /&gt;
unsigned volatile long lastVSS2;&lt;br /&gt;
&lt;br /&gt;
volatile boolean lastVssFlop = vssFlop;&lt;br /&gt;
&lt;br /&gt;
//attach the vss/buttons interrupt      &lt;br /&gt;
ISR( PCINT1_vect ){   &lt;br /&gt;
  static byte vsspinstate=0;      &lt;br /&gt;
  byte p = PINC;//bypassing digitalRead for interrupt performance      &lt;br /&gt;
  if ((p &amp;amp; vssBit) != (vsspinstate &amp;amp; vssBit)){      &lt;br /&gt;
    addEvent(enableVSSID,2 ); //check back in a couple milli&lt;br /&gt;
  }     &lt;br /&gt;
  if(lastVssFlop != vssFlop){&lt;br /&gt;
    lastVSS1=lastVSS2;&lt;br /&gt;
    unsigned long t = microSeconds();&lt;br /&gt;
    lastVSS2=elapsedMicroseconds(lastVSSTime,t);&lt;br /&gt;
    lastVSSTime=t;&lt;br /&gt;
    lastVssFlop = vssFlop;&lt;br /&gt;
  }&lt;br /&gt;
  vsspinstate = p;      &lt;br /&gt;
  buttonState &amp;amp;= p;      &lt;br /&gt;
}       &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
pFunc displayFuncs[] ={ &lt;br /&gt;
  doDisplayInstantCurrent, &lt;br /&gt;
  doDisplayInstantTank, &lt;br /&gt;
  doDisplayBigInstant, &lt;br /&gt;
  doDisplayBigCurrent, &lt;br /&gt;
  doDisplayBigTank, &lt;br /&gt;
  doDisplay2, &lt;br /&gt;
  doDisplay3, &lt;br /&gt;
  doDisplay4, &lt;br /&gt;
  doDisplay5, &lt;br /&gt;
  doDisplay6, &lt;br /&gt;
  doDisplay7};      &lt;br /&gt;
#define displayFuncSize (sizeof(displayFuncs)/sizeof(pFunc)) //array size      &lt;br /&gt;
prog_char  * displayFuncNames[displayFuncSize]; &lt;br /&gt;
byte newRun = 0;&lt;br /&gt;
void setup (void){&lt;br /&gt;
  init2();&lt;br /&gt;
  #ifdef debuguino  &lt;br /&gt;
  Serial.begin(9600);  &lt;br /&gt;
  Serial.println(&amp;quot;OpenGauge MPGuino online&amp;quot;);  &lt;br /&gt;
  #endif      &lt;br /&gt;
  newRun = load();//load the default parameters&lt;br /&gt;
  displayFuncNames[0]=  PSTR(&amp;quot;Instant/Current &amp;quot;); &lt;br /&gt;
  displayFuncNames[1]=  PSTR(&amp;quot;Instant/Tank &amp;quot;); &lt;br /&gt;
  displayFuncNames[2]=  PSTR(&amp;quot;BIG Instant &amp;quot;); &lt;br /&gt;
  displayFuncNames[3]=  PSTR(&amp;quot;BIG Current &amp;quot;); &lt;br /&gt;
  displayFuncNames[4]=  PSTR(&amp;quot;BIG Tank &amp;quot;); &lt;br /&gt;
  displayFuncNames[5]=  PSTR(&amp;quot;Current &amp;quot;); &lt;br /&gt;
  displayFuncNames[6]=  PSTR(&amp;quot;Tank &amp;quot;); &lt;br /&gt;
  displayFuncNames[7]=  PSTR(&amp;quot;Instant raw Data&amp;quot;); &lt;br /&gt;
  displayFuncNames[8]=  PSTR(&amp;quot;Current raw Data&amp;quot;); &lt;br /&gt;
  displayFuncNames[9]=  PSTR(&amp;quot;Tank raw Data &amp;quot;); &lt;br /&gt;
  displayFuncNames[10]= PSTR(&amp;quot;CPU Monitor &amp;quot;);      &lt;br /&gt;
 &lt;br /&gt;
  pinMode(BrightnessPin,OUTPUT);      &lt;br /&gt;
  analogWrite(BrightnessPin,255-brightness[brightnessIdx]);      &lt;br /&gt;
  pinMode(EnablePin,OUTPUT);       &lt;br /&gt;
  pinMode(DIPin,OUTPUT);       &lt;br /&gt;
  pinMode(DB4Pin,OUTPUT);       &lt;br /&gt;
  pinMode(DB5Pin,OUTPUT);       &lt;br /&gt;
  pinMode(DB6Pin,OUTPUT);       &lt;br /&gt;
  pinMode(DB7Pin,OUTPUT);       &lt;br /&gt;
  delay2(500);      &lt;br /&gt;
 &lt;br /&gt;
  pinMode(ContrastPin,OUTPUT);      &lt;br /&gt;
  analogWrite(ContrastPin,parms[contrastIdx]);  &lt;br /&gt;
  LCD::init();      &lt;br /&gt;
  LCD::LcdCommandWrite(B00000001);  // clear display, set cursor position to zero         &lt;br /&gt;
  LCD::LcdCommandWrite(B10000000);  // set dram to zero&lt;br /&gt;
  LCD::gotoXY(0,0); &lt;br /&gt;
  LCD::print(getStr(PSTR(&amp;quot;OpenGauge       &amp;quot;)));      &lt;br /&gt;
  LCD::gotoXY(0,1);      &lt;br /&gt;
  LCD::print(getStr(PSTR(&amp;quot;  MPGuino  v0.70&amp;quot;)));      &lt;br /&gt;
&lt;br /&gt;
  pinMode(InjectorOpenPin, INPUT);       &lt;br /&gt;
  pinMode(InjectorClosedPin, INPUT);       &lt;br /&gt;
  pinMode(VSSPin, INPUT);            &lt;br /&gt;
  attachInterrupt(0, processInjOpen, FALLING);      &lt;br /&gt;
  attachInterrupt(1, processInjClosed, RISING);      &lt;br /&gt;
 &lt;br /&gt;
  pinMode( lbuttonPin, INPUT );       &lt;br /&gt;
  pinMode( mbuttonPin, INPUT );       &lt;br /&gt;
  pinMode( rbuttonPin, INPUT );      &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
  //&amp;quot;turn on&amp;quot; the internal pullup resistors      &lt;br /&gt;
  digitalWrite( lbuttonPin, HIGH);       &lt;br /&gt;
  digitalWrite( mbuttonPin, HIGH);       &lt;br /&gt;
  digitalWrite( rbuttonPin, HIGH);       &lt;br /&gt;
//  digitalWrite( VSSPin, HIGH);       &lt;br /&gt;
 &lt;br /&gt;
  //low level interrupt enable stuff      &lt;br /&gt;
  PCMSK1 |= (1 &amp;lt;&amp;lt; PCINT8);&lt;br /&gt;
  enableLButton();&lt;br /&gt;
  enableMButton();&lt;br /&gt;
  enableRButton();&lt;br /&gt;
  PCICR |= (1 &amp;lt;&amp;lt; PCIE1);       &lt;br /&gt;
 &lt;br /&gt;
  delay2(1500);       &lt;br /&gt;
}       &lt;br /&gt;
 &lt;br /&gt;
byte screen=0;      &lt;br /&gt;
byte holdDisplay = 0; &lt;br /&gt;
&lt;br /&gt;
#define looptime 1000000ul/loopsPerSecond //1/2 second      &lt;br /&gt;
void loop (void){       &lt;br /&gt;
  if(newRun !=1)&lt;br /&gt;
    initGuino();//go through the initialization screen&lt;br /&gt;
  unsigned long lastActivity =microSeconds();&lt;br /&gt;
  unsigned long tankHold;      //state at point of last activity&lt;br /&gt;
  while(true){      &lt;br /&gt;
    unsigned long loopStart=microSeconds();      &lt;br /&gt;
    instant.reset();           //clear instant      &lt;br /&gt;
    cli();&lt;br /&gt;
    instant.update(tmpTrip);   //&amp;quot;copy&amp;quot; of tmpTrip in instant now      &lt;br /&gt;
    tmpTrip.reset();           //reset tmpTrip first so we don't lose too many interrupts      &lt;br /&gt;
    sei();&lt;br /&gt;
    &lt;br /&gt;
    #ifdef debuguino  &lt;br /&gt;
    Serial.print(&amp;quot;instant: &amp;quot;);Serial.print(instant.injHiSec);Serial.print(&amp;quot;,&amp;quot;);Serial.print(instant.injHius);  &lt;br /&gt;
    Serial.print(&amp;quot;,&amp;quot;);Serial.print(instant.injPulses);Serial.print(&amp;quot;,&amp;quot;);Serial.println(instant.vssPulses);      &lt;br /&gt;
    #endif  &lt;br /&gt;
    current.update(instant);   //use instant to update current      &lt;br /&gt;
    tank.update(instant);      //use instant to update tank      &lt;br /&gt;
    #ifdef debuguino  &lt;br /&gt;
    Serial.print(&amp;quot;current: &amp;quot;);Serial.print(current.injHiSec);Serial.print(&amp;quot;,&amp;quot;);Serial.print(current.injHius);  &lt;br /&gt;
    Serial.print(&amp;quot;,&amp;quot;);Serial.print(current.injPulses);Serial.print(&amp;quot;,&amp;quot;);Serial.println(current.vssPulses);      &lt;br /&gt;
    #endif  &lt;br /&gt;
&lt;br /&gt;
//currentTripResetTimeoutUS&lt;br /&gt;
    if(instant.vssPulses == 0 &amp;amp;&amp;amp; instant.injPulses == 0 &amp;amp;&amp;amp; holdDisplay==0){&lt;br /&gt;
      if(elapsedMicroseconds(lastActivity) &amp;gt; parms[currentTripResetTimeoutUSIdx] &amp;amp;&amp;amp; lastActivity != 3999999999ul){&lt;br /&gt;
        analogWrite(BrightnessPin,255-brightness[0]);    //nitey night&lt;br /&gt;
        lastActivity = 3999999999ul;&lt;br /&gt;
      }&lt;br /&gt;
    }else{&lt;br /&gt;
      if(lastActivity == 3999999999ul){//wake up!!!&lt;br /&gt;
        analogWrite(BrightnessPin,255-brightness[brightnessIdx]);    &lt;br /&gt;
        lastActivity=loopStart;&lt;br /&gt;
        current.reset();&lt;br /&gt;
        tank.loopCount = tankHold;&lt;br /&gt;
        current.update(instant); &lt;br /&gt;
        tank.update(instant); &lt;br /&gt;
      }else{&lt;br /&gt;
        lastActivity=loopStart;&lt;br /&gt;
        tankHold = tank.loopCount;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 if(holdDisplay==0){&lt;br /&gt;
    displayFuncs[screen]();    //call the appropriate display routine      &lt;br /&gt;
    LCD::gotoXY(0,0);        &lt;br /&gt;
    &lt;br /&gt;
//see if any buttons were pressed, display a brief message if so      &lt;br /&gt;
      if(!(buttonState&amp;amp;lbuttonBit) &amp;amp;&amp;amp; !(buttonState&amp;amp;mbuttonBit)&amp;amp;&amp;amp; !(buttonState&amp;amp;rbuttonBit)){// left and middle and right = initialize      &lt;br /&gt;
          LCD::print(getStr(PSTR(&amp;quot;Setup &amp;quot;)));    &lt;br /&gt;
          initGuino();  &lt;br /&gt;
      //}else if(!(buttonState&amp;amp;lbuttonBit) &amp;amp;&amp;amp; !(buttonState&amp;amp;rbuttonBit)){// left and right = run lcd init = tank reset      &lt;br /&gt;
      //    LCD::print(getStr(PSTR(&amp;quot;Init LCD &amp;quot;))); &lt;br /&gt;
      //    LCD::init();&lt;br /&gt;
      }else if (!(buttonState&amp;amp;lbuttonBit) &amp;amp;&amp;amp; !(buttonState&amp;amp;mbuttonBit)){// left and middle = tank reset      &lt;br /&gt;
          tank.reset();      &lt;br /&gt;
          LCD::print(getStr(PSTR(&amp;quot;Tank Reset &amp;quot;)));      &lt;br /&gt;
      }else if(!(buttonState&amp;amp;mbuttonBit) &amp;amp;&amp;amp; !(buttonState&amp;amp;rbuttonBit)){// right and middle = current reset      &lt;br /&gt;
          current.reset();      &lt;br /&gt;
          LCD::print(getStr(PSTR(&amp;quot;Current Reset &amp;quot;)));      &lt;br /&gt;
      }else if(!(buttonState&amp;amp;lbuttonBit)){ //left is rotate through screeens to the left      &lt;br /&gt;
        if(screen!=0)      &lt;br /&gt;
          screen=(screen-1);       &lt;br /&gt;
        else      &lt;br /&gt;
          screen=displayFuncSize-1;      &lt;br /&gt;
        LCD::print(getStr(displayFuncNames[screen]));      &lt;br /&gt;
      }else if(!(buttonState&amp;amp;mbuttonBit)){ //middle is cycle through brightness settings      &lt;br /&gt;
        brightnessIdx = (brightnessIdx + 1) % brightnessLength;      &lt;br /&gt;
        analogWrite(BrightnessPin,255-brightness[brightnessIdx]);      &lt;br /&gt;
        LCD::print(getStr(PSTR(&amp;quot;Brightness &amp;quot;)));      &lt;br /&gt;
        LCD::LcdDataWrite('0' + brightnessIdx);      &lt;br /&gt;
        LCD::print(&amp;quot; &amp;quot;);      &lt;br /&gt;
      }else if(!(buttonState&amp;amp;rbuttonBit)){//right is rotate through screeens to the left      &lt;br /&gt;
        screen=(screen+1)%displayFuncSize;      &lt;br /&gt;
        LCD::print(getStr(displayFuncNames[screen]));      &lt;br /&gt;
      }      &lt;br /&gt;
      if(buttonState!=buttonsUp)&lt;br /&gt;
         holdDisplay=1;&lt;br /&gt;
     }else{&lt;br /&gt;
        holdDisplay=0;&lt;br /&gt;
    } &lt;br /&gt;
    buttonState=buttonsUp;//reset the buttons      &lt;br /&gt;
 &lt;br /&gt;
      //keep track of how long the loops take before we go int waiting.      &lt;br /&gt;
      unsigned long loopX=elapsedMicroseconds(loopStart);      &lt;br /&gt;
      if(loopX&amp;gt;maxLoopLength) maxLoopLength = loopX;      &lt;br /&gt;
 &lt;br /&gt;
      while (elapsedMicroseconds(loopStart) &amp;lt; (looptime));//wait for the end of a second to arrive      &lt;br /&gt;
  }      &lt;br /&gt;
 &lt;br /&gt;
}       &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
char fBuff[7];//used by format      &lt;br /&gt;
//format a number into NNN.NN  the number should already be representing thousandths      &lt;br /&gt;
char* format(unsigned long num){      &lt;br /&gt;
  unsigned long d = 10000;      &lt;br /&gt;
  long t;      &lt;br /&gt;
  byte dp=3;      &lt;br /&gt;
  byte l=6;      &lt;br /&gt;
 &lt;br /&gt;
  //123456 = 123.46      &lt;br /&gt;
  if(num&amp;gt;9999999){      &lt;br /&gt;
    d=100000;      &lt;br /&gt;
    dp=99;      &lt;br /&gt;
    num/=100;      &lt;br /&gt;
  }else if(num&amp;gt;999999){      &lt;br /&gt;
    dp=4;      &lt;br /&gt;
    num/=10;      &lt;br /&gt;
  }      &lt;br /&gt;
 &lt;br /&gt;
  unsigned long val = num/10;      &lt;br /&gt;
  if ((num - (val * 10)) &amp;gt;= 5)  //will the first unprinted digit be greater than 4?      &lt;br /&gt;
    val += 1;   //round up val      &lt;br /&gt;
 &lt;br /&gt;
  for(byte x = 0; x &amp;lt; l; x++){      &lt;br /&gt;
    if(x==dp)      //time to poke in the decimal point?      &lt;br /&gt;
      fBuff[x]='.';      &lt;br /&gt;
    else{      &lt;br /&gt;
      t = val/d;        &lt;br /&gt;
      fBuff[x]= '0' + t%10;//poke the ascii character for the digit.      &lt;br /&gt;
      val-= t*d;      &lt;br /&gt;
      d/=10;            &lt;br /&gt;
    }      &lt;br /&gt;
  }      &lt;br /&gt;
  fBuff[6]= 0;         //good old zero terminated strings       &lt;br /&gt;
  return fBuff;      &lt;br /&gt;
}  &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//get a string from flash &lt;br /&gt;
char mBuff[17];//used by getStr &lt;br /&gt;
char * getStr(prog_char * str){ &lt;br /&gt;
  strcpy_P(mBuff, str); &lt;br /&gt;
  return mBuff; &lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
void doDisplayInstantCurrent(){displayTripCombo('I','M',instant.mpg(),'S',instantmph(),'C','M',current.mpg(),'D',current.miles());}      &lt;br /&gt;
 &lt;br /&gt;
void doDisplayInstantTank(){displayTripCombo('I','M',instant.mpg(),'S',instantmph(),'T','M',tank.mpg(),'D',tank.miles());}      &lt;br /&gt;
 &lt;br /&gt;
void doDisplayBigInstant() {bigNum(instant.mpg(),&amp;quot;INST&amp;quot;,&amp;quot;MPG &amp;quot;);}      &lt;br /&gt;
void doDisplayBigCurrent() {bigNum(current.mpg(),&amp;quot;CURR&amp;quot;,&amp;quot;MPG &amp;quot;);}      &lt;br /&gt;
void doDisplayBigTank()    {bigNum(tank.mpg(),&amp;quot;TANK&amp;quot;,&amp;quot;MPG &amp;quot;);}      &lt;br /&gt;
 &lt;br /&gt;
void doDisplay2(void){tDisplay(&amp;amp;current);}   //display current trip formatted data.        &lt;br /&gt;
void doDisplay3(void){tDisplay(&amp;amp;tank);}      //display tank trip formatted data.        &lt;br /&gt;
void doDisplay4(void){rawDisplay(&amp;amp;instant);} //display instant trip &amp;quot;raw&amp;quot; injector and vss data.        &lt;br /&gt;
void doDisplay5(void){rawDisplay(&amp;amp;current);} //display current trip &amp;quot;raw&amp;quot; injector and vss data.        &lt;br /&gt;
void doDisplay6(void){rawDisplay(&amp;amp;tank);}    //display tank trip &amp;quot;raw&amp;quot; injector and vss data.        &lt;br /&gt;
void doDisplay7(void){      &lt;br /&gt;
  LCD::gotoXY(0,0);LCD::print(&amp;quot;C%&amp;quot;);LCD::print(format(maxLoopLength*1000/(looptime/100)));LCD::print(&amp;quot; T&amp;quot;); LCD::print(format(tank.time()));     &lt;br /&gt;
  unsigned long mem = memoryTest();      &lt;br /&gt;
  mem*=1000;      &lt;br /&gt;
  LCD::gotoXY(0,1);LCD::print(&amp;quot;FREE MEM: &amp;quot;);LCD::print(format(mem));      &lt;br /&gt;
}    //display max cpu utilization and ram.        &lt;br /&gt;
 &lt;br /&gt;
void displayTripCombo(char t1, char t1L1, unsigned long t1V1, char t1L2, unsigned long t1V2,  char t2, char t2L1, unsigned long t2V1, char t2L2, unsigned long t2V2){ &lt;br /&gt;
  LCD::gotoXY(0,0);LCD::LcdDataWrite(t1);LCD::LcdDataWrite(t1L1);LCD::print(format(t1V1));LCD::LcdDataWrite(' '); &lt;br /&gt;
      LCD::LcdDataWrite(t1L2);LCD::print(format(t1V2)); &lt;br /&gt;
  LCD::gotoXY(0,1);LCD::LcdDataWrite(t2);LCD::LcdDataWrite(t2L1);LCD::print(format(t2V1));LCD::LcdDataWrite(' '); &lt;br /&gt;
      LCD::LcdDataWrite(t2L2);LCD::print(format(t2V2)); &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
//arduino doesn't do well with types defined in a script as parameters, so have to pass as void * and use -&amp;gt; notation.      &lt;br /&gt;
void tDisplay( void * r){ //display trip functions.        &lt;br /&gt;
  Trip *t = (Trip *)r;      &lt;br /&gt;
  LCD::gotoXY(0,0);LCD::print(&amp;quot;MH&amp;quot;);LCD::print(format(t-&amp;gt;mph()));LCD::print(&amp;quot;MG&amp;quot;);LCD::print(format(t-&amp;gt;mpg()));      &lt;br /&gt;
  LCD::gotoXY(0,1);LCD::print(&amp;quot;MI&amp;quot;);LCD::print(format(t-&amp;gt;miles()));LCD::print(&amp;quot;GA&amp;quot;);LCD::print(format(t-&amp;gt;gallons()));      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
void rawDisplay(void * r){      &lt;br /&gt;
  Trip *t = (Trip *)r;      &lt;br /&gt;
  LCD::gotoXY(0,0);LCD::print(&amp;quot;IJ&amp;quot;);LCD::print(format(t-&amp;gt;injHiSec*1000));LCD::print(&amp;quot;uS&amp;quot;);LCD::print(format(t-&amp;gt;injHius*1000));      &lt;br /&gt;
  LCD::gotoXY(0,1);LCD::print(&amp;quot;IC&amp;quot;);LCD::print(format(t-&amp;gt;injPulses*1000));LCD::print(&amp;quot;VC&amp;quot;);LCD::print(format(t-&amp;gt;vssPulses*1000));      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    &lt;br /&gt;
//x=0..16, y= 0..1      &lt;br /&gt;
void LCD::gotoXY(byte x, byte y){      &lt;br /&gt;
  byte dr=x+0x80;      &lt;br /&gt;
  if (y==1)       &lt;br /&gt;
    dr += 0x40;      &lt;br /&gt;
  if (y==2)       &lt;br /&gt;
    dr += 0x14;      &lt;br /&gt;
  if (y==3)       &lt;br /&gt;
    dr += 0x54;      &lt;br /&gt;
  LCD::LcdCommandWrite(dr);        &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
void LCD::print(char * string){      &lt;br /&gt;
  byte x = 0;      &lt;br /&gt;
  char c = string[x];      &lt;br /&gt;
  while(c != 0){      &lt;br /&gt;
    LCD::LcdDataWrite(c);       &lt;br /&gt;
    x++;      &lt;br /&gt;
    c = string[x];      &lt;br /&gt;
  }      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
void LCD::init(){&lt;br /&gt;
  delay2(16);                    // wait for more than 15 msec&lt;br /&gt;
  pushNibble(B00110000);  // send (B0011) to DB7-4&lt;br /&gt;
  cmdWriteSet();&lt;br /&gt;
  tickleEnable();&lt;br /&gt;
  delay2(5);                     // wait for more than 4.1 msec&lt;br /&gt;
  pushNibble(B00110000);  // send (B0011) to DB7-4&lt;br /&gt;
  cmdWriteSet();&lt;br /&gt;
  tickleEnable();&lt;br /&gt;
  delay2(1);                     // wait for more than 100 usec&lt;br /&gt;
  pushNibble(B00110000);  // send (B0011) to DB7-4&lt;br /&gt;
  cmdWriteSet();&lt;br /&gt;
  tickleEnable();&lt;br /&gt;
  delay2(1);                     // wait for more than 100 usec&lt;br /&gt;
  pushNibble(B00100000);  // send (B0010) to DB7-4 for 4bit&lt;br /&gt;
  cmdWriteSet();&lt;br /&gt;
  tickleEnable();&lt;br /&gt;
  delay2(1);                     // wait for more than 100 usec&lt;br /&gt;
  // ready to use normal LcdCommandWrite() function now!&lt;br /&gt;
  LcdCommandWrite(B00101000);   // 4-bit interface, 2 display lines, 5x8 font&lt;br /&gt;
  LcdCommandWrite(B00001100);   // display control:&lt;br /&gt;
  LcdCommandWrite(B00000110);   // entry mode set: increment automatically, no display shift&lt;br /&gt;
&lt;br /&gt;
//creating the custom fonts:&lt;br /&gt;
  LcdCommandWrite(B01001000);  // set cgram&lt;br /&gt;
  static byte chars[] PROGMEM ={&lt;br /&gt;
    B11111,B00000,B11111,B11111,B00000,&lt;br /&gt;
    B11111,B00000,B11111,B11111,B00000,&lt;br /&gt;
    B11111,B00000,B11111,B11111,B00000,&lt;br /&gt;
    B00000,B00000,B00000,B11111,B00000,&lt;br /&gt;
    B00000,B00000,B00000,B11111,B00000,&lt;br /&gt;
    B00000,B11111,B11111,B11111,B01110,&lt;br /&gt;
    B00000,B11111,B11111,B11111,B01110,&lt;br /&gt;
    B00000,B11111,B11111,B11111,B01110};&lt;br /&gt;
&lt;br /&gt;
    for(byte x=0;x&amp;lt;5;x++)&lt;br /&gt;
      for(byte y=0;y&amp;lt;8;y++)&lt;br /&gt;
          LcdDataWrite(pgm_read_byte(&amp;amp;chars[y*5+x])); //write the character data to the character generator ram&lt;br /&gt;
&lt;br /&gt;
  LcdCommandWrite(B00000001);  // clear display, set cursor position to zero&lt;br /&gt;
  LcdCommandWrite(B10000000);  // set dram to zero&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void  LCD::tickleEnable(){       &lt;br /&gt;
  // send a pulse to enable       &lt;br /&gt;
  digitalWrite(EnablePin,HIGH);       &lt;br /&gt;
  delayMicroseconds2(1);  // pause 1 ms according to datasheet       &lt;br /&gt;
  digitalWrite(EnablePin,LOW);       &lt;br /&gt;
  delayMicroseconds2(1);  // pause 1 ms according to datasheet       &lt;br /&gt;
}        &lt;br /&gt;
 &lt;br /&gt;
void LCD::cmdWriteSet(){       &lt;br /&gt;
  digitalWrite(EnablePin,LOW);       &lt;br /&gt;
  delayMicroseconds2(1);  // pause 1 ms according to datasheet       &lt;br /&gt;
  digitalWrite(DIPin,0);       &lt;br /&gt;
}       &lt;br /&gt;
 &lt;br /&gt;
byte LCD::pushNibble(byte value){       &lt;br /&gt;
  digitalWrite(DB7Pin, value &amp;amp; 128);       &lt;br /&gt;
  value &amp;lt;&amp;lt;= 1;       &lt;br /&gt;
  digitalWrite(DB6Pin, value &amp;amp; 128);       &lt;br /&gt;
  value &amp;lt;&amp;lt;= 1;       &lt;br /&gt;
  digitalWrite(DB5Pin, value &amp;amp; 128);       &lt;br /&gt;
  value &amp;lt;&amp;lt;= 1;       &lt;br /&gt;
  digitalWrite(DB4Pin, value &amp;amp; 128);       &lt;br /&gt;
  value &amp;lt;&amp;lt;= 1;       &lt;br /&gt;
  return value;      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
void LCD::LcdCommandWrite(byte value){       &lt;br /&gt;
  value=pushNibble(value);      &lt;br /&gt;
  cmdWriteSet();       &lt;br /&gt;
  tickleEnable();       &lt;br /&gt;
  value=pushNibble(value);      &lt;br /&gt;
  cmdWriteSet();       &lt;br /&gt;
  tickleEnable();       &lt;br /&gt;
  delay2(5);       &lt;br /&gt;
}       &lt;br /&gt;
 &lt;br /&gt;
void LCD::LcdDataWrite(byte value){       &lt;br /&gt;
  digitalWrite(DIPin, HIGH);       &lt;br /&gt;
  value=pushNibble(value);      &lt;br /&gt;
  tickleEnable();       &lt;br /&gt;
  value=pushNibble(value);      &lt;br /&gt;
  tickleEnable();       &lt;br /&gt;
  delay2(5);       &lt;br /&gt;
}       &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
// this function will return the number of bytes currently free in RAM      &lt;br /&gt;
extern int  __bss_end; &lt;br /&gt;
extern int  *__brkval; &lt;br /&gt;
int memoryTest(){ &lt;br /&gt;
  int free_memory; &lt;br /&gt;
  if((int)__brkval == 0) &lt;br /&gt;
    free_memory = ((int)&amp;amp;free_memory) - ((int)&amp;amp;__bss_end); &lt;br /&gt;
  else &lt;br /&gt;
    free_memory = ((int)&amp;amp;free_memory) - ((int)__brkval); &lt;br /&gt;
  return free_memory; &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
Trip::Trip(){      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
//for display computing&lt;br /&gt;
unsigned long tmp1[2];&lt;br /&gt;
unsigned long tmp2[2];&lt;br /&gt;
unsigned long tmp3[2];&lt;br /&gt;
&lt;br /&gt;
unsigned long instantmph(){      &lt;br /&gt;
  cli();&lt;br /&gt;
  unsigned long vssPulseTimeuS = (lastVSS1 + lastVSS2) / 2;&lt;br /&gt;
  sei();&lt;br /&gt;
  init64(tmp1,0,1000000000ul);&lt;br /&gt;
  init64(tmp2,0,parms[vssPulsesPerMileIdx]);&lt;br /&gt;
  div64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,3600);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,vssPulseTimeuS);&lt;br /&gt;
  div64(tmp1,tmp2);&lt;br /&gt;
  return tmp1[1];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
unsigned long instantmpg(){      &lt;br /&gt;
  cli();&lt;br /&gt;
  unsigned long vssPulseTimeuS = (lastVSS1 + lastVSS2) / 2;&lt;br /&gt;
  sei();&lt;br /&gt;
  init64(tmp1,0,1000000000ul); &lt;br /&gt;
  init64(tmp2,0,parms[vssPulsesPerMileIdx]);&lt;br /&gt;
  div64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,3600);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,vssPulseTimeuS);&lt;br /&gt;
  div64(tmp1,tmp2);&lt;br /&gt;
//  return tmp1[1];&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
    init64(tmp1,0,instant.injHiSec);&lt;br /&gt;
  init64(tmp2,0,1000000);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,instant.injHius);&lt;br /&gt;
  add64(tmp1,tmp2); &lt;br /&gt;
  init64(tmp2,0,1000);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,parms[microSecondsPerGallonIdx]);&lt;br /&gt;
  div64(tmp1,tmp2);&lt;br /&gt;
  return tmp1[1];      &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
unsigned long Trip::miles(){      &lt;br /&gt;
  init64(tmp1,0,vssPulses);&lt;br /&gt;
  init64(tmp2,0,1000);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,parms[vssPulsesPerMileIdx]);&lt;br /&gt;
  div64(tmp1,tmp2);&lt;br /&gt;
  return tmp1[1];      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
unsigned long Trip::mph(){      &lt;br /&gt;
  if(loopCount == 0)     &lt;br /&gt;
     return 0;     &lt;br /&gt;
  init64(tmp1,0,loopsPerSecond);&lt;br /&gt;
  init64(tmp2,0,vssPulses);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,3600000);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,parms[vssPulsesPerMileIdx]);&lt;br /&gt;
  div64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,loopCount);&lt;br /&gt;
  div64(tmp1,tmp2);&lt;br /&gt;
  return tmp1[1];      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
unsigned long  Trip::gallons(){      &lt;br /&gt;
  init64(tmp1,0,injHiSec);&lt;br /&gt;
  init64(tmp2,0,1000000);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,injHius);&lt;br /&gt;
  add64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,1000);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,parms[microSecondsPerGallonIdx]);&lt;br /&gt;
  div64(tmp1,tmp2);&lt;br /&gt;
  return tmp1[1];      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
unsigned long  Trip::mpg(){      &lt;br /&gt;
  if(vssPulses==0) return 0;      &lt;br /&gt;
  if(injPulses==0) return 999999000; //who doesn't like to see 999999?  :)      &lt;br /&gt;
 &lt;br /&gt;
  init64(tmp1,0,injHiSec);&lt;br /&gt;
  init64(tmp3,0,1000000);&lt;br /&gt;
  mul64(tmp3,tmp1);&lt;br /&gt;
  init64(tmp1,0,injHius);&lt;br /&gt;
  add64(tmp3,tmp1);&lt;br /&gt;
  init64(tmp1,0,parms[vssPulsesPerMileIdx]);&lt;br /&gt;
  mul64(tmp3,tmp1);&lt;br /&gt;
 &lt;br /&gt;
  init64(tmp1,0,parms[microSecondsPerGallonIdx]);&lt;br /&gt;
  init64(tmp2,0,1000);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
  init64(tmp2,0,vssPulses);&lt;br /&gt;
  mul64(tmp1,tmp2);&lt;br /&gt;
 &lt;br /&gt;
  div64(tmp1,tmp3);&lt;br /&gt;
  return tmp1[1];      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
//return the seconds as a time mmm.ss, eventually hhh:mm too      &lt;br /&gt;
unsigned long Trip::time(){      &lt;br /&gt;
//  return seconds*1000;      &lt;br /&gt;
  byte d = 60;      &lt;br /&gt;
  unsigned long seconds = loopCount/loopsPerSecond;     &lt;br /&gt;
//  if(seconds/60 &amp;gt; 999) d = 3600; //scale up to hours.minutes if we get past 999 minutes      &lt;br /&gt;
  return ((seconds/d)*1000) + ((seconds%d) * 10);       &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
void Trip::reset(){      &lt;br /&gt;
  loopCount=0;      &lt;br /&gt;
  injPulses=0;      &lt;br /&gt;
  injHius=0;      &lt;br /&gt;
  injHiSec=0;      &lt;br /&gt;
  vssPulses=0;      &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
void Trip::update(Trip t){     &lt;br /&gt;
  loopCount++;  //we call update once per loop     &lt;br /&gt;
  vssPulses+=t.vssPulses;      &lt;br /&gt;
  if(t.injPulses &amp;gt; 2 &amp;amp;&amp;amp; t.injHius&amp;lt;500000){//chasing ghosts      &lt;br /&gt;
    injPulses+=t.injPulses;      &lt;br /&gt;
    injHius+=t.injHius;      &lt;br /&gt;
    if (injHius&amp;gt;=1000000){  //rollover into the injHiSec counter      &lt;br /&gt;
      injHiSec++;      &lt;br /&gt;
      injHius-=1000000;      &lt;br /&gt;
    }      &lt;br /&gt;
  }      &lt;br /&gt;
}   &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
char bignumchars1[]={4,1,4,0, 1,4,32,0, 3,3,4,0, 1,3,4,0, 4,2,4,0,   4,3,3,0, 4,3,3,0, 1,1,4,0,   4,3,4,0, 4,3,4,0}; &lt;br /&gt;
char bignumchars2[]={4,2,4,0, 2,4,2,0,  4,2,2,0, 2,2,4,0, 32,32,4,0, 2,2,4,0, 4,2,4,0, 32,4,32,0, 4,2,4,0, 2,2,4,0};  &lt;br /&gt;
 &lt;br /&gt;
void bigNum (unsigned long t, char * txt1, char * txt2){      &lt;br /&gt;
//  unsigned long t = 98550ul;//number in thousandths &lt;br /&gt;
//  unsigned long t = 9855ul;//number in thousandths &lt;br /&gt;
//  char * txt1=&amp;quot;INST&amp;quot;; &lt;br /&gt;
//  char * txt2=&amp;quot;MPG &amp;quot;; &lt;br /&gt;
  char  dp = 32; &lt;br /&gt;
 &lt;br /&gt;
  char * r = &amp;quot;009.99&amp;quot;; //&amp;quot;009.99&amp;quot; &amp;quot;000.99&amp;quot; &amp;quot;000.09&amp;quot; &lt;br /&gt;
  if(t&amp;lt;=99500){ &lt;br /&gt;
    r=format(t/10); //009.86 &lt;br /&gt;
    dp=5; &lt;br /&gt;
  }else if(t&amp;lt;=999500){ &lt;br /&gt;
    r=format(t/100); //009.86 &lt;br /&gt;
  }   &lt;br /&gt;
 &lt;br /&gt;
  LCD::gotoXY(0,0); &lt;br /&gt;
  LCD::print(bignumchars1+(r[2]-'0')*4); &lt;br /&gt;
  LCD::print(&amp;quot; &amp;quot;); &lt;br /&gt;
  LCD::print(bignumchars1+(r[4]-'0')*4); &lt;br /&gt;
  LCD::print(&amp;quot; &amp;quot;); &lt;br /&gt;
  LCD::print(bignumchars1+(r[5]-'0')*4); &lt;br /&gt;
  LCD::print(&amp;quot; &amp;quot;); &lt;br /&gt;
  LCD::print(txt1); &lt;br /&gt;
 &lt;br /&gt;
  LCD::gotoXY(0,1); &lt;br /&gt;
  LCD::print(bignumchars2+(r[2]-'0')*4); &lt;br /&gt;
  LCD::print(&amp;quot; &amp;quot;); &lt;br /&gt;
  LCD::print(bignumchars2+(r[4]-'0')*4); &lt;br /&gt;
  LCD::LcdDataWrite(dp); &lt;br /&gt;
  LCD::print(bignumchars2+(r[5]-'0')*4); &lt;br /&gt;
  LCD::print(&amp;quot; &amp;quot;); &lt;br /&gt;
  LCD::print(txt2); &lt;br /&gt;
}      &lt;br /&gt;
 &lt;br /&gt;
//the standard 64 bit math brings in  5000+ bytes&lt;br /&gt;
//these bring in 1214 bytes, and everything is pass by reference&lt;br /&gt;
unsigned long zero64[]={0,0};&lt;br /&gt;
 &lt;br /&gt;
void init64(unsigned long  an[], unsigned long bigPart, unsigned long littlePart ){&lt;br /&gt;
  an[0]=bigPart;&lt;br /&gt;
  an[1]=littlePart;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//left shift 64 bit &amp;quot;number&amp;quot;&lt;br /&gt;
void shl64(unsigned long  an[]){&lt;br /&gt;
 an[0] &amp;lt;&amp;lt;= 1; &lt;br /&gt;
 if(an[1] &amp;amp; 0x80000000)&lt;br /&gt;
   an[0]++; &lt;br /&gt;
 an[1] &amp;lt;&amp;lt;= 1; &lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//right shift 64 bit &amp;quot;number&amp;quot;&lt;br /&gt;
void shr64(unsigned long  an[]){&lt;br /&gt;
 an[1] &amp;gt;&amp;gt;= 1; &lt;br /&gt;
 if(an[0] &amp;amp; 0x1)&lt;br /&gt;
   an[1]+=0x80000000; &lt;br /&gt;
 an[0] &amp;gt;&amp;gt;= 1; &lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//add ann to an&lt;br /&gt;
void add64(unsigned long  an[], unsigned long  ann[]){&lt;br /&gt;
  an[0]+=ann[0];&lt;br /&gt;
  if(an[1] + ann[1] &amp;lt; ann[1])&lt;br /&gt;
    an[0]++;&lt;br /&gt;
  an[1]+=ann[1];&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//subtract ann from an&lt;br /&gt;
void sub64(unsigned long  an[], unsigned long  ann[]){&lt;br /&gt;
  an[0]-=ann[0];&lt;br /&gt;
  if(an[1] &amp;lt; ann[1]){&lt;br /&gt;
    an[0]--;&lt;br /&gt;
  }&lt;br /&gt;
  an[1]-= ann[1];&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//true if an == ann&lt;br /&gt;
boolean eq64(unsigned long  an[], unsigned long  ann[]){&lt;br /&gt;
  return (an[0]==ann[0]) &amp;amp;&amp;amp; (an[1]==ann[1]);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//true if an &amp;lt; ann&lt;br /&gt;
boolean lt64(unsigned long  an[], unsigned long  ann[]){&lt;br /&gt;
  if(an[0]&amp;gt;ann[0]) return false;&lt;br /&gt;
  return (an[0]&amp;lt;ann[0]) || (an[1]&amp;lt;ann[1]);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//divide num by den&lt;br /&gt;
void div64(unsigned long num[], unsigned long den[]){&lt;br /&gt;
  unsigned long quot[2];&lt;br /&gt;
  unsigned long qbit[2];&lt;br /&gt;
  unsigned long tmp[2];&lt;br /&gt;
  init64(quot,0,0);&lt;br /&gt;
  init64(qbit,0,1);&lt;br /&gt;
 &lt;br /&gt;
  if (eq64(num, zero64)) {  //numerator 0, call it 0&lt;br /&gt;
    init64(num,0,0);&lt;br /&gt;
    return;        &lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  if (eq64(den, zero64)) { //numerator not zero, denominator 0, infinity in my book.&lt;br /&gt;
    init64(num,0xffffffff,0xffffffff);&lt;br /&gt;
    return;        &lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  init64(tmp,0x80000000,0);&lt;br /&gt;
  while(lt64(den,tmp)){&lt;br /&gt;
    shl64(den);&lt;br /&gt;
    shl64(qbit);&lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  while(!eq64(qbit,zero64)){&lt;br /&gt;
    if(lt64(den,num) || eq64(den,num)){&lt;br /&gt;
      sub64(num,den);&lt;br /&gt;
      add64(quot,qbit);&lt;br /&gt;
    }&lt;br /&gt;
    shr64(den);&lt;br /&gt;
    shr64(qbit);&lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  //remainder now in num, but using it to return quotient for now  &lt;br /&gt;
  init64(num,quot[0],quot[1]); &lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//multiply num by den&lt;br /&gt;
void mul64(unsigned long an[], unsigned long ann[]){&lt;br /&gt;
  unsigned long p[2] = {0,0};&lt;br /&gt;
  unsigned long y[2] = {ann[0], ann[1]};&lt;br /&gt;
  while(!eq64(y,zero64)) {&lt;br /&gt;
    if(y[1] &amp;amp; 1) &lt;br /&gt;
      add64(p,an);&lt;br /&gt;
    shl64(an);&lt;br /&gt;
    shr64(y);&lt;br /&gt;
  }&lt;br /&gt;
  init64(an,p[0],p[1]);&lt;br /&gt;
} &lt;br /&gt;
  &lt;br /&gt;
void save(){&lt;br /&gt;
  EEPROM.write(0,guinosig);&lt;br /&gt;
  byte p = 0;&lt;br /&gt;
  for(int x=4; p &amp;lt; parmsLength; x+= 4){&lt;br /&gt;
    unsigned long v = parms[p];&lt;br /&gt;
    EEPROM.write(x ,(v&amp;gt;&amp;gt;24)&amp;amp;255);&lt;br /&gt;
    EEPROM.write(x + 1,(v&amp;gt;&amp;gt;16)&amp;amp;255);&lt;br /&gt;
    EEPROM.write(x + 2,(v&amp;gt;&amp;gt;8)&amp;amp;255);&lt;br /&gt;
    EEPROM.write(x + 3,(v)&amp;amp;255);&lt;br /&gt;
    p++;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
byte load(){ //return 1 if loaded ok&lt;br /&gt;
  byte b = EEPROM.read(0);&lt;br /&gt;
  if(b == guinosig){&lt;br /&gt;
    byte p = 0;&lt;br /&gt;
&lt;br /&gt;
    for(int x=4; p &amp;lt; parmsLength; x+= 4){&lt;br /&gt;
      unsigned long v = EEPROM.read(x);&lt;br /&gt;
      v = (v &amp;lt;&amp;lt; 8) + EEPROM.read(x+1);&lt;br /&gt;
      v = (v &amp;lt;&amp;lt; 8) + EEPROM.read(x+2);&lt;br /&gt;
      v = (v &amp;lt;&amp;lt; 8) + EEPROM.read(x+3);&lt;br /&gt;
      parms[p]=v;&lt;br /&gt;
      p++;&lt;br /&gt;
    }&lt;br /&gt;
    return 1;&lt;br /&gt;
  }&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
char * uformat(unsigned long val){ &lt;br /&gt;
  unsigned long d = 1000000000ul;&lt;br /&gt;
  for(byte p = 0; p &amp;lt; 10 ; p++){&lt;br /&gt;
    mBuff[p]='0' + (val/d);&lt;br /&gt;
    val=val-(val/d*d);&lt;br /&gt;
    d/=10;&lt;br /&gt;
  }&lt;br /&gt;
  mBuff[10]=0;&lt;br /&gt;
  return mBuff;&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
unsigned long rformat(char * val){ &lt;br /&gt;
  unsigned long d = 1000000000ul;&lt;br /&gt;
  unsigned long v = 0ul;&lt;br /&gt;
  for(byte p = 0; p &amp;lt; 10 ; p++){&lt;br /&gt;
    v=v+(d*(val[p]-'0'));&lt;br /&gt;
    d/=10;&lt;br /&gt;
  }&lt;br /&gt;
  return v;&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void editParm(byte parmIdx){&lt;br /&gt;
  unsigned long v = parms[parmIdx];&lt;br /&gt;
  byte p=9;  //right end of 10 digit number&lt;br /&gt;
  //display label on top line&lt;br /&gt;
  //set cursor visible&lt;br /&gt;
  //set pos = 0&lt;br /&gt;
  //display v&lt;br /&gt;
&lt;br /&gt;
    LCD::gotoXY(8,0);        &lt;br /&gt;
    LCD::print(&amp;quot;        &amp;quot;);&lt;br /&gt;
    LCD::gotoXY(0,0);        &lt;br /&gt;
    LCD::print(parmLabels[parmIdx]);&lt;br /&gt;
    LCD::gotoXY(0,1);    &lt;br /&gt;
    char * fmtv=    uformat(v);&lt;br /&gt;
    LCD::print(fmtv);&lt;br /&gt;
    LCD::print(&amp;quot; OK XX&amp;quot;);&lt;br /&gt;
    LCD::LcdCommandWrite(B00001110);&lt;br /&gt;
&lt;br /&gt;
    for(int x=9 ; x&amp;gt;=0 ;x--){ //do a nice thing and put the cursor at the first non zero number&lt;br /&gt;
      if(fmtv[x] != '0')&lt;br /&gt;
         p=x; &lt;br /&gt;
    }&lt;br /&gt;
  byte keyLock=1;    &lt;br /&gt;
  while(true){&lt;br /&gt;
&lt;br /&gt;
    if(p&amp;lt;10)&lt;br /&gt;
      LCD::gotoXY(p,1);   &lt;br /&gt;
    if(p==10)     &lt;br /&gt;
      LCD::gotoXY(11,1);   &lt;br /&gt;
    if(p==11)     &lt;br /&gt;
      LCD::gotoXY(14,1);   &lt;br /&gt;
&lt;br /&gt;
     if(keyLock == 0){ &lt;br /&gt;
       if(!(buttonState&amp;amp;lbuttonBit)){// left&lt;br /&gt;
            p=p-1;&lt;br /&gt;
            if(p==255)p=11;&lt;br /&gt;
        }else if(!(buttonState&amp;amp;rbuttonBit)){// right&lt;br /&gt;
             p=p+1;&lt;br /&gt;
            if(p==12)p=0;&lt;br /&gt;
        }else if(!(buttonState&amp;amp;mbuttonBit)){// middle&lt;br /&gt;
             if(p==11){  //cancel selected&lt;br /&gt;
                LCD::LcdCommandWrite(B00001100);&lt;br /&gt;
                return;&lt;br /&gt;
             }&lt;br /&gt;
             if(p==10){  //ok selected&lt;br /&gt;
                LCD::LcdCommandWrite(B00001100);&lt;br /&gt;
                parms[parmIdx]=rformat(fmtv);&lt;br /&gt;
                return;&lt;br /&gt;
             }&lt;br /&gt;
             &lt;br /&gt;
             byte n = fmtv[p]-'0';&lt;br /&gt;
             n++;&lt;br /&gt;
             if (n &amp;gt; 9) n=0;&lt;br /&gt;
             if(p==0 &amp;amp;&amp;amp; n &amp;gt; 3) n=0;&lt;br /&gt;
             fmtv[p]='0'+ n;&lt;br /&gt;
             LCD::gotoXY(0,1);        &lt;br /&gt;
             LCD::print(fmtv);&lt;br /&gt;
             LCD::gotoXY(p,1);        &lt;br /&gt;
             if(parmIdx==contrastIdx)//adjust contrast dynamically&lt;br /&gt;
                 analogWrite(ContrastPin,rformat(fmtv));  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
      if(buttonState!=buttonsUp)&lt;br /&gt;
         keyLock=1;&lt;br /&gt;
     }else{&lt;br /&gt;
        keyLock=0;&lt;br /&gt;
     }&lt;br /&gt;
      buttonState=buttonsUp;&lt;br /&gt;
      delay2(125);&lt;br /&gt;
  }      &lt;br /&gt;
  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void initGuino(){ //edit all the parameters&lt;br /&gt;
  for(int x = 0;x&amp;lt;parmsLength;x++)&lt;br /&gt;
    editParm(x);&lt;br /&gt;
  save();&lt;br /&gt;
  holdDisplay=1;&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
unsigned long millis2(){&lt;br /&gt;
	return timer2_overflow_count * 64UL * 2 / (16000000UL / 128000UL);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void delay2(unsigned long ms){&lt;br /&gt;
	unsigned long start = millis2();&lt;br /&gt;
	while (millis2() - start &amp;lt; ms);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Delay for the given number of microseconds.  Assumes a 16 MHz clock. &lt;br /&gt;
 * Disables interrupts, which will disrupt the millis2() function if used&lt;br /&gt;
 * too frequently. */&lt;br /&gt;
void delayMicroseconds2(unsigned int us){&lt;br /&gt;
	uint8_t oldSREG;&lt;br /&gt;
	if (--us == 0)	return;&lt;br /&gt;
	us &amp;lt;&amp;lt;= 2;&lt;br /&gt;
	us -= 2;&lt;br /&gt;
	oldSREG = SREG;&lt;br /&gt;
	cli();&lt;br /&gt;
	// busy wait&lt;br /&gt;
	__asm__ __volatile__ (&lt;br /&gt;
		&amp;quot;1: sbiw %0,1&amp;quot; &amp;quot;\n\t&amp;quot; // 2 cycles&lt;br /&gt;
		&amp;quot;brne 1b&amp;quot; : &amp;quot;=w&amp;quot; (us) : &amp;quot;0&amp;quot; (us) // 2 cycles&lt;br /&gt;
	);&lt;br /&gt;
	// reenable interrupts.&lt;br /&gt;
	SREG = oldSREG;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void init2(){&lt;br /&gt;
	// this needs to be called before setup() or some functions won't&lt;br /&gt;
	// work there&lt;br /&gt;
	sei();&lt;br /&gt;
	&lt;br /&gt;
	// timer 0 is used for millis2() and delay2()&lt;br /&gt;
	timer2_overflow_count = 0;&lt;br /&gt;
	// on the ATmega168, timer 0 is also used for fast hardware pwm&lt;br /&gt;
	// (using phase-correct PWM would mean that timer 0 overflowed half as often&lt;br /&gt;
	// resulting in different millis2() behavior on the ATmega8 and ATmega168)&lt;br /&gt;
        TCCR2A=1&amp;lt;&amp;lt;WGM20|1&amp;lt;&amp;lt;WGM21;&lt;br /&gt;
	// set timer 2 prescale factor to 64&lt;br /&gt;
        TCCR2B=1&amp;lt;&amp;lt;CS22;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//      TCCR2A=TCCR0A;&lt;br /&gt;
//      TCCR2B=TCCR0B;&lt;br /&gt;
	// enable timer 2 overflow interrupt&lt;br /&gt;
	TIMSK2|=1&amp;lt;&amp;lt;TOIE2;&lt;br /&gt;
	// disable timer 0 overflow interrupt&lt;br /&gt;
	TIMSK0&amp;amp;=!(1&amp;lt;&amp;lt;TOIE0);&lt;br /&gt;
}&lt;br /&gt;
{{default}}&lt;/div&gt;</summary>
		<author><name>Combustor</name></author>	</entry>

	</feed>