<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://forum.robosavvy.com/feed.php?f=21&amp;t=8205" />

<title>RoboSavvy Forum</title>
<subtitle>Robosavvy Forum: The largest online community of Humanoid Robot Builders</subtitle>
<link href="http://forum.robosavvy.com/index.php" />
<updated>2012-09-03T08:05:48+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=21&amp;t=8205</id>
<entry>
<author><name><![CDATA[MOHIT JINDAL]]></name></author>
<updated>2012-09-03T08:05:48+01:00</updated>
<published>2012-09-03T08:05:48+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35300#p35300</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35300#p35300"/>
<title type="html"><![CDATA[Magnetic Encoder AS5145 pins]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35300#p35300"><![CDATA[
I have found one code,but I don't think its for getting angle\position of DC motor. <br /><dl class="codebox"><dt>Code: </dt><dd><code>const int ledPin = 13; // LED connected to digital pin 13, used as a heartbeat<br />const int clockPin = 7; // output to clock<br />const int CSnPin = 6; // output to chip select<br />const int inputPin = 2; // read AS5045<br /><br />int inputstream = 0; // one bit read from pin<br />long packeddata = 0; // two bytes concatenated from inputstream<br />long angle = 0; // holds processed angle value<br />long anglemask = 262080; // 0x111111111111000000: mask to obtain first 12 digits with position info<br />long statusmask = 63; // 0x000000000000111111; mask to obtain last 6 digits containing status info<br />long statusbits; // holds status/error information<br />int DECn; // bit holding decreasing magnet field error data<br />int INCn; // bit holding increasing magnet field error data<br />int OCF; // bit holding startup-valid bit<br />int COF; // bit holding cordic DSP processing error data<br />int LIN; // bit holding magnet field displacement error data<br />int debug = 1; // SET THIS TO 0 TO DISABLE PRINTING OF ERROR CODES<br /><br />void setup&#40;&#41;<br />&#123; <br />Serial.begin&#40;9600&#41;;<br />pinMode&#40;ledPin, OUTPUT&#41;; // visual signal of I/O to chip: heartbeat<br />pinMode&#40;clockPin, OUTPUT&#41;; // SCK<br />pinMode&#40;CSnPin, OUTPUT&#41;; // CSn -- has to toggle high and low to signal chip to start data transfer<br />pinMode&#40;inputPin, INPUT&#41;; // SDA<br />&#125;<br /><br />void loop&#40;&#41; <br />&#123;<br />// CSn needs to cycle from high to low to initiate transfer. Then clock cycles. As it goes high<br />// again, data will appear on sda<br />digitalWrite&#40;CSnPin, HIGH&#41;; // CSn high<br />digitalWrite&#40;clockPin, HIGH&#41;; // CLK high<br />delay&#40;1000&#41;; // wait for 1 second for no particular reason<br />digitalWrite&#40;ledPin, HIGH&#41;; // signal start of transfer with LED<br />digitalWrite&#40;CSnPin, LOW&#41;; // CSn low: start of transfer<br />delay&#40;100&#41;; // delay for chip -- 1000x as long as it needs to be<br />digitalWrite&#40;clockPin, LOW&#41;; // CLK goes low: start clocking<br />delay&#40;10&#41;; // hold low for 10 ms<br />for &#40;int x=0; x &lt; 18; x++&#41; // clock signal, 18 transitions, output to clock pin<br />&#123; <br />digitalWrite&#40;clockPin, HIGH&#41;; // clock goes high<br />delay&#40;10&#41;; // wait 10ms<br />inputstream = digitalRead&#40;inputPin&#41;; // read one bit of data from pin<br />//Serial.print&#40;inputstream, DEC&#41;; // useful if you want to see the actual bits<br />packeddata = &#40;&#40;packeddata &lt;&lt;1&gt;&gt; 6&#41;; // shift 18-digit angle right 6 digits to form 12-digit value<br />//Serial.print&#40;&quot;angleshft:&quot;&#41;;<br />//Serial.println&#40;angle, BIN&#41;;<br />//Serial.print&#40;&quot;angledec: &quot;&#41;;<br />//Serial.println&#40;angle, DEC&#41;;<br />angle = angle * 0.08789; // angle * &#40;360/4096&#41; == actual degrees<br />Serial.print&#40;&quot;angle: &quot;&#41;; // and, finally, print it.<br />Serial.println&#40;angle, DEC&#41;;<br />//Serial.println&#40;&quot;--------------------&quot;&#41;;<br />//Serial.print&#40;&quot;raw: &quot;&#41;; // this was the prefix for the bit-by-bit diag output inside the loop.<br />if &#40;debug&#41;<br />&#123;<br />statusbits = packeddata &amp; statusmask;<br />DECn = statusbits &amp; 2; // goes high if magnet moved away from IC<br />INCn = statusbits &amp; 4; // goes high if magnet moved towards IC<br />LIN = statusbits &amp; 8; // goes high for linearity alarm<br />COF = statusbits &amp; 16; // goes high for cordic overflow: data invalid<br />OCF = statusbits &amp; 32; // this is 1 when the chip startup is finished.<br />if &#40;DECn &amp;&amp; INCn&#41; &#123; Serial.println&#40;&quot;magnet moved out of range&quot;&#41;; &#125;<br />else<br />&#123;<br />if &#40;DECn&#41; &#123; Serial.println&#40;&quot;magnet moved away from chip&quot;&#41;; &#125;<br />if &#40;INCn&#41; &#123; Serial.println&#40;&quot;magnet moved towards chip&quot;&#41;; &#125;<br />&#125;<br />if &#40;LIN&#41; &#123; Serial.println&#40;&quot;linearity alarm: magnet misaligned? Data questionable.&quot;&#41;; &#125;<br />if &#40;COF&#41; &#123; Serial.println&#40;&quot;cordic overflow: magnet misaligned? Data invalid.&quot;&#41;; &#125;<br />&#125;<br /><br />packeddata = 0; // reset both variables to zero so they don't just accumulate<br />angle = 0;<br />&#125;<br /></code></dd></dl><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2428">MOHIT JINDAL</a> — Mon Sep 03, 2012 8:05 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MOHIT JINDAL]]></name></author>
<updated>2012-08-31T09:16:50+01:00</updated>
<published>2012-08-31T09:16:50+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35286#p35286</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35286#p35286"/>
<title type="html"><![CDATA[Magnetic Encoder AS5145 pins]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35286#p35286"><![CDATA[
Yes i already posted on arduino forums and 2 other forums. No help with the code. Trossen blocked my account saying i am a spammer. <img src="http://forum.robosavvy.com/images/smilies/icon_lol.gif" alt=":lol:" title="Laughing" />  maybe one day we will get all sensors plug n play. After 2020. <img src="http://forum.robosavvy.com/images/smilies/icon_cool.gif" alt="8)" title="Cool" /><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2428">MOHIT JINDAL</a> — Fri Aug 31, 2012 9:16 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mog123]]></name></author>
<updated>2012-08-31T08:42:28+01:00</updated>
<published>2012-08-31T08:42:28+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35285#p35285</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35285#p35285"/>
<title type="html"><![CDATA[Magnetic Encoder AS5145 pins]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35285#p35285"><![CDATA[
I didn't write any. Besides, You need to learn how to research these things for yourself<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1932">mog123</a> — Fri Aug 31, 2012 8:42 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MOHIT JINDAL]]></name></author>
<updated>2012-08-31T02:39:58+01:00</updated>
<published>2012-08-31T02:39:58+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35284#p35284</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35284#p35284"/>
<title type="html"><![CDATA[Magnetic Encoder AS5145 pins]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35284#p35284"><![CDATA[
Thanks. Can you give me your code which you wrote ?  <img src="http://forum.robosavvy.com/images/smilies/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2428">MOHIT JINDAL</a> — Fri Aug 31, 2012 2:39 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mog123]]></name></author>
<updated>2012-08-30T21:23:38+01:00</updated>
<published>2012-08-30T21:23:38+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35283#p35283</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35283#p35283"/>
<title type="html"><![CDATA[Magnetic Encoder AS5145 pins]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35283#p35283"><![CDATA[
If you are talking about incremental mode, then you should connect Dtest1_A and Dtest1_B to IO2 and IO3 which correspond with the atmega328p external interrupts. Then you will to learn how the incremental mode works and implement an external interrupt oriented code. Other modes will need more fiddling, because of the reprogramming of the AS5145 chip which is quite a hard task when tackling these chips for the first time. Good luck!<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1932">mog123</a> — Thu Aug 30, 2012 9:23 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MOHIT JINDAL]]></name></author>
<updated>2012-08-28T02:59:53+01:00</updated>
<published>2012-08-28T02:59:53+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35251#p35251</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35251#p35251"/>
<title type="html"><![CDATA[Magnetic Encoder AS5145 pins]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=8205&amp;p=35251#p35251"><![CDATA[
Hi; I want to connect magnetic encoder AS5145 to Arduino Uno 3. Can anyone here tell me which pins of encoder go where in Uno 3 ? I want to get the position/angle of the DC motor from AS5145. I attached the datasheet in My Files section. Please read. <img src="http://forum.robosavvy.com/images/smilies/icon_confused.gif" alt=":?" title="Confused" /> File name is AS5145 HSSU.pdf<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2428">MOHIT JINDAL</a> — Tue Aug 28, 2012 2:59 am</p><hr />
]]></content>
</entry>
</feed>