<?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>How to configure IO pin as analog input</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10276/how-to-configure-io-pin-as-analog-input</link><description>Hi all, 
 I am having ADXL335 Acellarometer board. Here its giving data of X,Y and Z axis directly in analog form.
So how should i configure my IO pins of PCA10001 board so i can read the data from Accelarometer board and print it over UART. 
 I try</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 17 Nov 2015 20:14:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10276/how-to-configure-io-pin-as-analog-input" /><item><title>RE: How to configure IO pin as analog input</title><link>https://devzone.nordicsemi.com/thread/38142?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2015 20:14:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c96e7fdb-9214-4d42-ac8b-0831379cdeac</guid><dc:creator>atune</dc:creator><description>&lt;p&gt;For reference:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.pdf.ps/nRF51822_PS_v3.1.pdf"&gt;nRF51822 Product Specification&lt;/a&gt;:&lt;/li&gt;
&lt;li&gt;2.1 Block Diagram&lt;/li&gt;
&lt;li&gt;2.2 Pin assignments and functions&lt;/li&gt;
&lt;li&gt;4.14 Analog to Digital Converter (ADC)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.pdf.rm/nRF51_RM_v3.0.pdf"&gt;nRF51822 Reference Manual&lt;/a&gt;:&lt;/li&gt;
&lt;li&gt;14 General-Purpose Input/Output (GPIO)&lt;/li&gt;
&lt;li&gt;31 Analog to Digital Converter (ADC)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk51.v10.0.0%2Fgroup__nrf__adc.html"&gt;ADC HAL&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So did you check out the &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk51.v10.0.0%2Fnrf_dev_adc_example.html"&gt;ADC HAL Example&lt;/a&gt; which is /examples/peripheral/adc_simple in the SDK? &lt;a href="https://github.com/NordicSemiconductor/nrf51-ADC-examples/blob/master/simultaneous-adc-sampling-from-two-inputs/main.c"&gt;Here&amp;#39;s&lt;/a&gt; also an example of reading from two inputs &amp;#39;simultaneously&amp;#39; (without nrf adc driver).&lt;/p&gt;
&lt;p&gt;In the SDK example, input is selected with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_2);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and that&amp;#39;s about it. Triggering a conversion reads the analog value from the selected input pin.&lt;/p&gt;
&lt;p&gt;From the reference manual:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Other peripherals in the system can attach themselves to GPIO pins and override their output value and
configuration, or read their analog or digital input value ...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;With the nRF you don&amp;#39;t need to explicitly configure the pins unless you wish to use them as digital GPIO. Just configure the ADC and your pin is good to go.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>