<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>problem in analog read.........?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/20854/problem-in-analog-read</link><description>hai 
 i am using mbed to program my nrf51822. in my application i need to read two analog sensor values.
i am using p5 and p6 pin for that. 
 AnalogIn analog_pin_1(p5);
 AnalogIn analog_pin_2(p6);
 
 now i have a periodic call back attached to a</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Sep 2017 10:33:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/20854/problem-in-analog-read" /><item><title>RE: problem in analog read.........?</title><link>https://devzone.nordicsemi.com/thread/81437?ContentTypeID=1</link><pubDate>Wed, 20 Sep 2017 10:33:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c88eb248-4d50-4a6e-8abc-58538c8ce1d9</guid><dc:creator>ThomasWe</dc:creator><description>&lt;p&gt;I use Mbed. I found the solution to my problem here:
&lt;a href="https://devzone.nordicsemi.com/question/29560/nrf51822-adc-without-uart/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;
It works now. Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem in analog read.........?</title><link>https://devzone.nordicsemi.com/thread/81439?ContentTypeID=1</link><pubDate>Wed, 20 Sep 2017 04:50:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52fdd577-48eb-4dda-8af8-5416ccc12d57</guid><dc:creator>iqbalpalemad</dc:creator><description>&lt;p&gt;@ThomasWe&lt;/p&gt;
&lt;p&gt;which platform are you using to program........?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem in analog read.........?</title><link>https://devzone.nordicsemi.com/thread/81438?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2017 17:15:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:624489d2-5106-46b9-b174-48b1557e14e0</guid><dc:creator>ThomasWe</dc:creator><description>&lt;p&gt;Hello, I have a similar problem, When I remove the UART I get 0 from my analog read and when I declare it I get the right value... have you been able to solve it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem in analog read.........?</title><link>https://devzone.nordicsemi.com/thread/81435?ContentTypeID=1</link><pubDate>Fri, 31 Mar 2017 05:23:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b243441-487f-47c1-a22a-75282499d1c1</guid><dc:creator>iqbalpalemad</dc:creator><description>&lt;p&gt;i will sent it to you by personal message.........&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem in analog read.........?</title><link>https://devzone.nordicsemi.com/thread/81433?ContentTypeID=1</link><pubDate>Thu, 30 Mar 2017 10:23:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc9a25c6-e6bf-4a44-8985-85e166573058</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;This sounds very strange. Would it be possible for you to share your mbed project? It would make it easier to debug the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem in analog read.........?</title><link>https://devzone.nordicsemi.com/thread/81436?ContentTypeID=1</link><pubDate>Wed, 29 Mar 2017 07:45:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9466f36-e531-4f2c-b8fc-7096173cfc9c</guid><dc:creator>iqbalpalemad</dc:creator><description>&lt;p&gt;hai
i have tried with a delay but there is no change in result.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void periodicCallback(void)
 {
  service_data[4] = calculate_percentage(analog_pin_1.read_u16());
  service_data[5] = calculate_percentage(analog_pin_2.read_u16());
  //printf(&amp;quot; percentage_1 : %d and perncentage_2 : %d \n\r&amp;quot;,service_data[4],service_data[5]);
  wait(.01);
  update_service_data();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and i have noticed that if the printf statement is commented then mcu miss reads the value.&lt;/p&gt;
&lt;p&gt;that is i have  declared one more anlog pin&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; AnalogIn   dummy(p1);
 AnalogIn   analog_pin_1(p5);
 AnalogIn   analog_pin_2(p6);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;now if i read the adc values without printf that is in servicedata&lt;/p&gt;
&lt;p&gt;the value shown at dummy pin is the value at  p5.
the value in both p5 &amp;amp; p6 are same always and is the value at p6.
there is no change in any value if i change the voltage at p1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: problem in analog read.........?</title><link>https://devzone.nordicsemi.com/thread/81434?ContentTypeID=1</link><pubDate>Tue, 28 Mar 2017 11:37:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1db5e378-2906-4d9b-b86b-2abec26f30ad</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Could you try adding a short delay before updating the service data?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>