<?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>Proximity app ADC Input</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45102/proximity-app-adc-input</link><description>I am using nRF51422 with the SDK 11. I am using the proximity application to measure the battery service. By default, the device uses VDD as its ADC input. I would like to change the input to another available pin (for example p0.00). How would I be able</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Mar 2019 11:09:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45102/proximity-app-adc-input" /><item><title>RE: Proximity app ADC Input</title><link>https://devzone.nordicsemi.com/thread/177293?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2019 11:09:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1b1c24c-919a-4765-88f7-15ffcbb23f06</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I assume you mean the ADC uses VDD as the ADC voltage reference?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;From the Proximity Application&amp;#39;s main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for configuring ADC to do battery level conversion.
 */
static void adc_configure(void)
{
    #ifdef NRF51
    ret_code_t err_code = nrf_drv_adc_init(NULL, adc_event_handler);
    APP_ERROR_CHECK(err_code);

    static nrf_drv_adc_channel_t channel = NRF_DRV_ADC_DEFAULT_CHANNEL(NRF_ADC_CONFIG_INPUT_DISABLED);
    //channel.config.config.input = NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD;
    channel.config.config.input = (uint32_t)NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD;
    nrf_drv_adc_channel_enable(&amp;amp;channel);

    err_code = nrf_drv_adc_buffer_convert(&amp;amp;adc_buf[0], 1);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is where the ADC is configured using the ADC HW driver. You must change NRF_ADC_CONFIG_INPUT_DISABLED to wanted channel.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static nrf_drv_adc_channel_t channel = NRF_DRV_ADC_DEFAULT_CHANNEL(NRF_ADC_CONFIG_INPUT_DISABLED);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;More information about the ADC driver can be found &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/group__nrf__adc.html?cp=4_0_10_6_7_0"&gt;here&lt;/a&gt;. The channels that are available for the ADC can be found &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/group__nrf__adc__hal.html?cp=4_0_10_6_7_0_1_2#ga7efdf26b2463b9e15aaaaffa76ee224f"&gt;here&lt;/a&gt;. Be aware that AIN0 (P0.00) is&amp;nbsp;ADC/LPCOMP reference input. Please read the nRF51422 Reference Manual chapter&amp;nbsp;31 Analog to Digital Converter (ADC) to ensure correct usage. Please have a look at &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/7317.ADC_5F00_Config.pdf"&gt;this document&amp;nbsp;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Oeyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>