<?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=17&amp;t=6030" />

<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>2010-07-27T03:28:43+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=17&amp;t=6030</id>
<entry>
<author><name><![CDATA[roboard]]></name></author>
<updated>2010-07-27T03:28:43+01:00</updated>
<published>2010-07-27T03:28:43+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27664#p27664</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27664#p27664"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27664#p27664"><![CDATA[
<blockquote><div><cite>ea4ps wrote:</cite><br />My fault!!! I did try and change the variable to 1023, for this reason in channel 7 I get 1023 value. Despite this, why do I get values like 32767 if these are inicializated or 496 and 1023 if nothing is connected?<br />I think that this happend because the adc chip is ?burned?<br /></div></blockquote><br /><br />When calling ad7918_InitializeMCH() with all channels and some channels return 32767, it indicates that some A/D channels can't respond possibly due to the A/D burned.<br /><br />Please try the same code with lower SPI clock: use spi_Initialize(SPICLK_10000KHZ) instead. If it gives the same results, your AD7918 chip might really be burned, and you can email <!-- e --><a href="mailto:tech@roboard.com">tech@roboard.com</a><!-- e --> for the repair issue. <img src="http://forum.robosavvy.com/images/smilies/icon_smile.gif" alt=":)" title="Smile" /><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1542">roboard</a> — Tue Jul 27, 2010 3:28 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ea4ps]]></name></author>
<updated>2010-07-26T14:02:56+01:00</updated>
<published>2010-07-26T14:02:56+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27659#p27659</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27659#p27659"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27659#p27659"><![CDATA[
My fault!!! I did try and change the variable to 1023, for this reason in channel 7 I get 1023 value. Despite this, why do I get values like 32767 if these are inicializated or 496 and 1023 if nothing is connected?<br />I think that this happend because the adc chip is ?burned?<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1918">ea4ps</a> — Mon Jul 26, 2010 2:02 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[roboard]]></name></author>
<updated>2010-07-26T13:40:48+01:00</updated>
<published>2010-07-26T13:40:48+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27658#p27658</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27658#p27658"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27658#p27658"><![CDATA[
<blockquote><div><cite>ea4ps wrote:</cite><br />My code is exactly the same as written here, the second message of this thread.<br /></div></blockquote><br /><br />Hi,<br /><br />that code does always not print value &gt; 511 (even if the ADC were broken) because it uses AD7918MODE_CODING_511 to initialize.<br /><br />That code is for RB-100, and, if your RoBoard is RB-110, you need to employ the newest version of RoBoIO (i.e., RoBoIO 1.6) and add roboio_SetRBVer(RB-110) at the beginning to try again. <img src="http://forum.robosavvy.com/images/smilies/icon_smile.gif" alt=":)" title="Smile" /><br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>#include &lt;stdio.h&gt; <br />#include &lt;roboard.h&gt; <br />int main&#40;&#41; <br />&#123; <br />   int* val; <br />   int c,i; <br />   //choose 0 ~ 7 channels that you want to use <br />   unsigned char usedchannels = AD7918_USECHANNEL0 + <br />                                                AD7918_USECHANNEL1 + <br />                                                AD7918_USECHANNEL2 + <br />                                                AD7918_USECHANNEL3 + <br />                                                AD7918_USECHANNEL4 + <br />                                                AD7918_USECHANNEL5 + <br />                                                AD7918_USECHANNEL6 + <br />                                                AD7918_USECHANNEL7; <br />   printf&#40;&quot;Start ADC\n&quot;&#41;; <br /><br />   roboio_SetRBVer&#40;RB-110&#41;;<br /><br />   //SPI interface should be initialized first <br />   if&#40;spi_Initialize&#40;SPICLK_21400KHZ&#41; == false&#41; <br />   &#123; <br />      printf&#40;&quot;SPI Initialize Failure : %s&quot;,roboio_GetErrMsg&#40;&#41;&#41;; <br />      spi_Close&#40;&#41;; <br />      return -1; <br />   &#125; <br /><br />   //Set AD7918 Input-voltage range: 0V ~ 5V , value range : -512 ~ 511 <br />   if &#40;ad7918_InitializeMCH&#40;usedchannels, AD7918MODE_RANGE_2VREF, AD7918MODE_CODING_511&#41; == false&#41; <br />   &#123; <br />      printf&#40;&quot;AD7918 Initialize Failure : %s&quot;,roboio_GetErrMsg&#40;&#41;&#41;; <br />      spi_Close&#40;&#41;; <br />      return -1; <br />   &#125; <br />    <br />   while&#40;&#40;c = getchar&#40;&#41;&#41; != 'q'&#41;//Press enter to read AD value or 'q' to exit <br />   &#123; <br />      if&#40;c == '\n'&#41; <br />      &#123; <br />         val = ad7918_ReadMCH&#40;&#41;; <br />         for&#40;i = 0;i &lt; 8;i++&#41; <br />            printf&#40;&quot;AD7918 channel %d = %d\n&quot;,i,val&#91;i&#93;&#41;; <br />      &#125; <br />   &#125; <br /><br />   ad7918_CloseMCH&#40;&#41;; <br />   spi_Close&#40;&#41;; <br />   return 0; <br />&#125; <br /><br /></code></dd></dl><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1542">roboard</a> — Mon Jul 26, 2010 1:40 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ea4ps]]></name></author>
<updated>2010-07-26T06:37:58+01:00</updated>
<published>2010-07-26T06:37:58+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27655#p27655</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27655#p27655"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27655#p27655"><![CDATA[
My code is exactly the same as written here, the second message of this thread.<br /><br />I really appreciate your help<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1918">ea4ps</a> — Mon Jul 26, 2010 6:37 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[roboard]]></name></author>
<updated>2010-07-26T06:27:40+01:00</updated>
<published>2010-07-26T06:27:40+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27654#p27654</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27654#p27654"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27654#p27654"><![CDATA[
<blockquote><div><cite>ea4ps wrote:</cite><br />Thanks for help me! but something goes wrong. Im executing this program and if Im wrong in this code are initialized all channels, however, I get out this:<br />AD7918 channel 0 = 32767<br />AD7918 channel 1 = 496<br />AD7918 channel 2 = 32767<br />AD7918 channel 3 = 32767<br />AD7918 channel 4 = 32767<br />AD7918 channel 5 = 32767<br />AD7918 channel 6 = 32767<br />AD7918 channel 7 = 1023<br /><br />and  I have nothing connected to any pin. If I connected any voltage exit of program is the same. ADC chip could be broken?<br /><br /><img src="http://forum.robosavvy.com/images/smilies/icon_neutral.gif" alt=":-|" title="Neutral" /><br /></div></blockquote><br /><br />Hi,<br /><br />please post you ADC code; we will check whether your code is correct. <img src="http://forum.robosavvy.com/images/smilies/icon_smile.gif" alt=":)" title="Smile" /><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1542">roboard</a> — Mon Jul 26, 2010 6:27 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ea4ps]]></name></author>
<updated>2010-07-23T20:37:14+01:00</updated>
<published>2010-07-23T20:37:14+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27604#p27604</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27604#p27604"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27604#p27604"><![CDATA[
<blockquote><div><cite>roboard wrote:</cite><br />Hi,<br /><br />If you initialize ad7918_InitializeMCH() with AD7918MODE_RANGE_2VREF option, the unit of the returned value is 5V/1024 (~5mV); and if with AD7918MODE_RANGE_VREF option, the unit is 2.5V/1024 (~2.5mV).<br /><br />Also, with AD7918MODE_CODING_1023 option, the returned value 0 corresponds to 0V, and value 1023 corresponds to the selected maximum voltage limit (2.5V or 5V);<br /><br />with AD7918MODE_CODING_511 option, the returned value -512 corresponds to 0V, and value 511 corresponds to the selected maximum voltage limit (2.5V or 5V).<br /><br />The returned value 32767 indicates an ADC fail or that the corresponding channel is not selected when calling ad7918_InitializeMCH().<br /></div></blockquote><br /><br />Thanks for help me! but something goes wrong. Im executing this program and if Im wrong in this code are initialized all channels, however, I get out this:<br />AD7918 channel 0 = 32767<br />AD7918 channel 1 = 496<br />AD7918 channel 2 = 32767<br />AD7918 channel 3 = 32767<br />AD7918 channel 4 = 32767<br />AD7918 channel 5 = 32767<br />AD7918 channel 6 = 32767<br />AD7918 channel 7 = 1023<br /><br />and  I have nothing connected to any pin. If I connected any voltage exit of program is the same. ADC chip could be broken?<br /><br /><img src="http://forum.robosavvy.com/images/smilies/icon_neutral.gif" alt=":-|" title="Neutral" /><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1918">ea4ps</a> — Fri Jul 23, 2010 8:37 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[roboard]]></name></author>
<updated>2010-07-20T04:31:31+01:00</updated>
<published>2010-07-20T04:31:31+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27546#p27546</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27546#p27546"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27546#p27546"><![CDATA[
<blockquote><div><cite>ea4ps wrote:</cite><br />Sorry for my ignorance but, the values returned (-512 if pin is null) are in units of milivolts (mV)?<br />...<br />For test, I connected one batterie (AA 1,5V) to ADC and the value returned was 32700, but I still don't know the equivalent of return value for ad7918_ReadMCH() and voltage.<br /></div></blockquote><br /><br />Hi,<br /><br />If you initialize ad7918_InitializeMCH() with AD7918MODE_RANGE_2VREF option, the unit of the returned value is 5V/1024 (~5mV); and if with AD7918MODE_RANGE_VREF option, the unit is 2.5V/1024 (~2.5mV).<br /><br />Also, with AD7918MODE_CODING_1023 option, the returned value 0 corresponds to 0V, and value 1023 corresponds to the selected maximum voltage limit (2.5V or 5V);<br /><br />with AD7918MODE_CODING_511 option, the returned value -512 corresponds to 0V, and value 511 corresponds to the selected maximum voltage limit (2.5V or 5V).<br /><br />The returned value 32767 indicates an ADC fail or that the corresponding channel is not selected when calling ad7918_InitializeMCH().<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1542">roboard</a> — Tue Jul 20, 2010 4:31 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[matt.stevenson]]></name></author>
<updated>2010-07-15T20:26:37+01:00</updated>
<published>2010-07-15T20:26:37+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27497#p27497</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27497#p27497"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27497#p27497"><![CDATA[
I haven't done any work with the ADC yet.<br />If I have some time later today, I will hook it up with my accelerometer and see if I can get it working properly.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2093">matt.stevenson</a> — Thu Jul 15, 2010 8:26 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ea4ps]]></name></author>
<updated>2010-07-15T19:35:35+01:00</updated>
<published>2010-07-15T19:35:35+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27495#p27495</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27495#p27495"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27495#p27495"><![CDATA[
Thank you for your advise.<br />I finally found out how to compile my main. I typed:<br />g++ -o demo demo.c -I../libsrc -L../ -static -lRBIO<br />in the place where demo.c contains the code of this thread.<br /><br />Sorry for my ignorance but, the values returned (-512 if pin is null) are in units of milivolts (mV)?<br />My temperature sensor returns values between 250 and 350 although the measure is in both at the same time, why the diffrence if temperature no change? In the datasheet (LM35) 250mV is equivalent to 25ºC. Near to heatsink I think that this value is wrong.<br />For test, I connected one batterie (AA 1,5V) to ADC and the value returned was 32700, but I still don't know the equivalent of return value for ad7918_ReadMCH() and voltage.<br /><br />Sorry for my very bad english <img src="http://forum.robosavvy.com/images/smilies/icon_sad.gif" alt=":-(" title="Sad" /><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1918">ea4ps</a> — Thu Jul 15, 2010 7:35 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[matt.stevenson]]></name></author>
<updated>2010-07-14T23:03:24+01:00</updated>
<published>2010-07-14T23:03:24+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27479#p27479</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27479#p27479"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27479#p27479"><![CDATA[
@ea4ps:<br />Are you running windows or linux?  From the gcc it sounds like linux.<br /><br />Have you managed to build the the roboard libraries first?  They come with a a Makefile Make.LINUX.  You can compile with:<br />make -f Make.LINUX<br /><br />Once you have that built, when you compile your code make sure to link the appropriate libraries in your gcc command.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2093">matt.stevenson</a> — Wed Jul 14, 2010 11:03 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ea4ps]]></name></author>
<updated>2010-07-14T21:13:30+01:00</updated>
<published>2010-07-14T21:13:30+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27478#p27478</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27478#p27478"/>
<title type="html"><![CDATA[Source code for test ADC]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=27478#p27478"><![CDATA[
Hi!<br /><br />I'm trying to test the source code downloaded roboard's web to use ADC for a sensor temperature but I can't even run the examples (e.g. Roboard.cpp).<br />I have also tried to create a myexample.c including the code write here for roboard user. If I compile this code with gcc -o myexe niexample.c I get a lot of errors.<br /><br />How I can test the examples?<br /><br />Thanks,<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1918">ea4ps</a> — Wed Jul 14, 2010 9:13 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[wahooburger]]></name></author>
<updated>2010-04-06T15:52:26+01:00</updated>
<published>2010-04-06T15:52:26+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26252#p26252</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26252#p26252"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26252#p26252"><![CDATA[
Hello,<br />thank you for the clarification.<br />Just got the Roboard yesterday, and should be able to start testing things out!<br />looking forward to working with it.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2035">wahooburger</a> — Tue Apr 06, 2010 3:52 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[roboard]]></name></author>
<updated>2010-04-06T06:56:09+01:00</updated>
<published>2010-04-06T06:56:09+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26247#p26247</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26247#p26247"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26247#p26247"><![CDATA[
<blockquote><div><cite>wahooburger wrote:</cite><br />Hello,<br /><br />Many thanks for the example.<br /><br />Does that source code implement a single reading of one A/D value that I can repeat when pressing the enter key? If so, can it be changed do continuous acquisition ( see example below)<br /><br />I am attempting to do a continuous acquisition at 1 kHz sampling rate over a period of 1 second, so I would want 1 second * 1 KSamples / second = 1000 samples each time I hit the enter key.<br /><br />Many thanks for your kind assistance.<br /><br />Regards,<br />Andy<br /></div></blockquote><br /><br />Hi,<br /><br />ad7918_ReadMCH() and related MCH functions use AD7918's continuous acquistion mode; they don't simply repeat the single reading. Please check the source code to see how they are implemented:)<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1542">roboard</a> — Tue Apr 06, 2010 6:56 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[wahooburger]]></name></author>
<updated>2010-04-01T15:08:34+01:00</updated>
<published>2010-04-01T15:08:34+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26181#p26181</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26181#p26181"/>
<title type="html"><![CDATA[continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26181#p26181"><![CDATA[
Hello,<br /><br />Many thanks for the example.<br /><br />Does that source code implement a single reading of one A/D value that I can repeat when pressing the enter key? If so, can it be changed do continuous acquisition ( see example below)<br /><br />I am attempting to do a continuous acquisition at 1 kHz sampling rate over a period of 1 second, so I would want 1 second * 1 KSamples / second = 1000 samples each time I hit the enter key.<br /><br />Many thanks for your kind assistance.<br /><br />Regards,<br />Andy<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2035">wahooburger</a> — Thu Apr 01, 2010 3:08 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[roboard]]></name></author>
<updated>2010-04-01T14:37:32+01:00</updated>
<published>2010-04-01T14:37:32+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26179#p26179</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26179#p26179"/>
<title type="html"><![CDATA[Re: continuous acquisition using the AD7918 on the RB-100]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=6030&amp;p=26179#p26179"><![CDATA[
<dl class="codebox"><dt>Code: </dt><dd><code>//Example : Analog to Digital Converter on RoBoard&#40;AD7918&#41;<br />#include &lt;stdio.h&gt;<br />#include &lt;roboard.h&gt;<br />int main&#40;&#41;<br />&#123;<br />   int* val;<br />   int c,i;<br />   //choose 0 ~ 7 channels that you want to use<br />   unsigned int usedchannels = AD7918_USECHANNEL0 + <br />                                             AD7918_USECHANNEL1 + <br />                                             AD7918_USECHANNEL2 + <br />                                             AD7918_USECHANNEL3 +<br />                                             AD7918_USECHANNEL4 +<br />                                             AD7918_USECHANNEL5 +<br />                                             AD7918_USECHANNEL6 +<br />                                             AD7918_USECHANNEL7;<br />   printf&#40;&quot;Start ADC\n&quot;&#41;;<br /><br />   //SPI interface should be initialized first<br />   if&#40;spi_Initialize&#40;SPICLK_21400KHZ&#41; == false&#41;<br />   &#123;<br />      printf&#40;&quot;SPI Initialize Failure : %s&quot;,roboio_GetErrMsg&#40;&#41;&#41;;<br />      spi_Close&#40;&#41;;<br />      return -1;<br />   &#125;<br /><br />   //Set AD7918 Input-voltage range: 0V ~ 5V , value range : -512 ~ 511<br />   if &#40;ad7918_InitializeMCH&#40;usedchannels,AD7918MODE_RANGE_2VREF,AD7918MODE_CODING_511&#41; == false&#41;<br />   &#123;<br />      printf&#40;&quot;AD7918 Initialize Failure : %s&quot;,roboio_GetErrMsg&#40;&#41;&#41;;<br />      spi_Close&#40;&#41;;<br />      return -1;<br />   &#125;<br />   <br />   while&#40;&#40;c = getchar&#40;&#41;&#41; != 'q'&#41;//Press enter to read AD value or 'q' to exit<br />   &#123;<br />      if&#40;c == '\n'&#41;<br />      &#123;<br />         val = ad7918_ReadMCH&#40;&#41;;<br />         for&#40;i = 0;i &lt; 8;i++&#41;<br />            printf&#40;&quot;AD7918 channel %d = %d\n&quot;,i,val&#91;i&#93;&#41;;<br />      &#125;<br />   &#125;<br /><br />   ad7918_CloseMCH&#40;&#41;;<br />   spi_Close&#40;&#41;;<br />   return 0;<br />&#125;<br /></code></dd></dl><p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1542">roboard</a> — Thu Apr 01, 2010 2:37 pm</p><hr />
]]></content>
</entry>
</feed>