<?xml version="1.0" encoding="utf-8"?>
				<!-- generator="e107" -->
				<!-- content type="Forum / topic" -->
				<rss  version="2.0">
				<channel>
				<title>8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes : Forum / topic</title>
				<link>http://www.8051projects.net/</link>
				<description>Learn to make simple microcontroller projects, pic, 8051, avr and arm projects. download 8051 projects, tutorials, libraries, sample codes. join the microcontroller discussion forum and ask doubts regarding electronics. the best source for 8051 over internet.</description>

<language>en-gb</language>
				<copyright><a rel="license" href="http://creativecommons.org/licenses/by-nc/2.5/in/" target="_blank"><img alt="Creative Commons License" width="80" height="15" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/2.5/in/80x15.png" target="_blank" /></a>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/2.5/in/" target="_blank">Creative Commons Attribution-Noncommercial 2.5 India License</a>.<a href='http://www.8051projects.net/disclaimer.htm' target='_blank' />Rickey's World Disclaimer</a></copyright>
				<managingEditor>Ajay Bhargav - contact@nospam.com</managingEditor>
				<webMaster>contact@nospam.com</webMaster>
				<pubDate>Mon, 01 Dec 2008 12:41:54 -0800</pubDate>
				<lastBuildDate>Mon, 01 Dec 2008 12:41:54 -0800</lastBuildDate>
				<docs>http://backend.userland.com/rss</docs>
				<generator>e107 (http://e107.org)</generator>
				<ttl>60</ttl>
				<textInput>
				<title>Search</title>
				<description>Search 8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes</description>
				<name>query</name>
				<link>http://www.8051projects.net/search.php</link>
				</textInput>
						<item>
						<title>Shaft Encoder code needed</title>
<link>http://www.8051projects.net/forum-t9368.html</link>
<description><![CDATA[Hi,<br />I think of it ...but could not figure out a right way, please help.<br />I need a shaft encoder code on direction.<br /><br />Need help...<br /><br />thanks<br /><br />Hi,<br />i found a code bbut i don really understand about the last 2 line,<br />--------------------------------------------------------------------------------------------------<br />extern signed short angle; /* rotation since reset */<br />static unsigned char ab = 0; /* the old value of the sensor ports */<br />const signed short table[] = {0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,-1,0};<br />/* increment of angle for the 16 possible bit codes */<br />ab = ab &lt;&lt; 2; /* move the old data left two places */<br />ab |= (port &amp; 0x3); /* OR in the two new bits */<br />angle += table[(ab &amp; 0xf)]; /* get the change from the 16 entry table */<br /><br />-------------------------------------------------------------------------------------------------<br />http://www.mkesc.co.uk/ise.pdf<br /><br />details on the document...<br /><br />Thanks...<br />what i want to know is ... wat is the port stated here and why 0&amp;3 ?<br />then... angle += table[(ab &amp; 0xf)];       then wat is this means?<br />]]></description>
<pubDate>Wed, 07 May 2008 22:43:18 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9368.html</guid>
</item>
						<item>
						<title>Re: Shaft Encoder code needed</title>
<link>http://www.8051projects.net/forum-t9368.html</link>
<description><![CDATA[There can be three cases:<br />first shaft rotated clockwise: +1<br />shaft rotated anti-clockwise: -1<br />shaft did not rotate: 0<br /><br />as per the datasheet of encoder, there are four cases for +1 and four for -1 rest all are 0.<br /><div class='code_box'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">//By default or at starting ab is 0</span><br /><span style="color: #808080; font-style: italic;">//means your shaft did not move or still</span><br />ab = ab &lt;&lt; <span style="color: #cc66cc;">2</span>;<br /><span style="color: #808080; font-style: italic;">// Now you shifted the already read value of ab by 2 bits</span><br /><span style="color: #808080; font-style: italic;">// so that you can accommodate new two bits from encoder</span><br /><span style="color: #808080; font-style: italic;">// there new two bits give the current movement of shaft</span><br />ab |= <span style="color: #66cc66;">&#40;</span>port &amp; 0x3<span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #808080; font-style: italic;">// now you read the two bits from port and appended it with old bits</span><br /><span style="color: #808080; font-style: italic;">// and you have a 4bit number now</span><br /><span style="color: #808080; font-style: italic;">// see table on page 2 of datasheet, every number tells you whether your shaft moved clockwise or anti-clockwise.</span><br /><span style="color: #808080; font-style: italic;">// these values are stored in array and read with current value of ab</span><br />&nbsp;</div></div><br />]]></description>
<author>Ajay&lt;contact@nospam.com&gt;</author>
<pubDate>Thu, 08 May 2008 16:53:05 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9368.html</guid>
</item>
				</channel>
				</rss>