<?xml version="1.0" encoding="utf-8" ?>
				<!-- generator="e107" -->
				<!-- content type="Forum / topic" -->
				<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
				<channel rdf:about="http://www.8051projects.net/">
				<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>
				<dc:language>en-gb</dc:language>
				<dc:date>2008-12-02T00:32:16-08:00</dc:date>
				<dc:creator>contact@nospam.com</dc:creator>
				<admin:generatorAgent rdf:resource="http://e107.org" />
				<admin:errorReportsTo rdf:resource="mailto:contact@nospam.com" />
				<sy:updatePeriod>hourly</sy:updatePeriod>
				<sy:updateFrequency>1</sy:updateFrequency>
				<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
				<items>
				<rdf:Seq>
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t9368.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t9368.html" />
				</rdf:Seq>
				</items>
				</channel>
						<item rdf:about="http://www.8051projects.net/forum-t9368.html">
						<title>Shaft Encoder code needed</title>
						<link>http://www.8051projects.net/forum-t9368.html</link>
						<dc:date>2008-12-02T00:32:16-08:00</dc:date>
						<dc:creator></dc:creator>
						<dc:subject></dc:subject>
						<description>Hi,I think of it ...but could not figure out a right way, please help.I need a shaft encoder code on direction.Need help...thanksHi,i found a code bbut i don really understand about the last 2 line,--------------------------------------------------------------------------------------------------extern signed short angle; /* rotation since reset */static unsigned char ab = 0; /* the old value of the sensor ports */const signed short table[] = {0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,-1,0};/* increment of angle for the 16 possible bit codes */ab = ab &lt;&lt; 2; /* move the old data left two places */ab |= (port &amp; 0x3); /* OR in the two new bits */angle += table[(ab &amp; 0xf)]; /* get the change from the 16 entry table */-------------------------------------------------------------------------------------------------http://www.mkesc.co.uk/ise.pdfdetails on the document...Thanks...what i want to know is ... wat is the port stated here and why 0&amp;3 ?then... angle += table[(ab &amp; 0xf)];       then wat is this means?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t9368.html">
						<title>Re: Shaft Encoder code needed</title>
						<link>http://www.8051projects.net/forum-t9368.html</link>
						<dc:date>2008-12-02T00:32:16-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>There can be three cases:first shaft rotated clockwise: +1shaft rotated anti-clockwise: -1shaft did not rotate: 0as per the datasheet of encoder, there are four cases for +1 and four for -1 rest all are 0.CODE://By default or at starting ab is 0<br />//means your shaft did not move or still<br />ab = ab &lt;&lt; 2;<br />// Now you shifted the already read value of ab by 2 bits<br />// so that you can accommodate new two bits from encoder<br />// there new two bits give the current movement of shaft<br />ab |= &#40;port &amp; 0x3&#41;;<br />// now you read the two bits from port and appended it with old bits<br />// and you have a 4bit number now<br />// see table on page 2 of datasheet, every number tells you whether your shaft moved clockwise or anti-clockwise.<br />// these values are stored in array and read with current value of ab<br />&nbsp;</description>
						</item>
				</rdf:RDF>