<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LPC 824 ADC - Issue in getting it to start conversion in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-824-ADC-Issue-in-getting-it-to-start-conversion/m-p/1038712#M40418</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Flourisha,&lt;/P&gt;&lt;P&gt;Regarding your code, I think you have to check the bit configuration.&lt;/P&gt;&lt;P&gt;1)clear bit4 to power the ADC, but you do nothing with the code. Setting bit4 to power down rather than power up.&lt;/P&gt;&lt;P&gt;LPC_SYSCON-&amp;gt;PDRUNCFG |= (0&amp;lt;&amp;lt;4); //Power the ADC&lt;/P&gt;&lt;P&gt;modify it to:&lt;/P&gt;&lt;P&gt;LPC_SYSCON-&amp;gt;PDRUNCFG &amp;amp;= ~(0&amp;lt;&amp;lt;4); //Power the ADC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/94651iFF9762595A5D0679/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)clear the bit in PINENABLE0 to enable the ADC function for the pin, but you set the bit with the code:&lt;/P&gt;&lt;P&gt;LPC_SWM-&amp;gt;PINENABLE0 |= (0&amp;lt;&amp;lt;23); //Enable ADC_10 on PIO0_13&lt;BR /&gt; LPC_SWM-&amp;gt;PINENABLE0 |= (0&amp;lt;&amp;lt;22); //Enable ADC_9 on PIO0_17&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/94781iA1E22EEB4D35DF1C/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You should use&lt;/P&gt;&lt;P&gt;LPC_SWM-&amp;gt;PINENABLE0 &amp;amp;=~ (0&amp;lt;&amp;lt;23); //Enable ADC_10 on PIO0_13&lt;BR /&gt; LPC_SWM-&amp;gt;PINENABLE0 &amp;amp;= ~(0&amp;lt;&amp;lt;22); //Enable ADC_9 on PIO0_17&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)for reset:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; LPC_SYSCON-&amp;gt;PRESETCTRL &amp;amp;= ~(0&amp;lt;&amp;lt;24); //RESET ADC&lt;BR /&gt; LPC_SYSCON-&amp;gt;PRESETCTRL |= (1&amp;lt;&amp;lt;24);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls have a try.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Nov 2019 06:42:09 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2019-11-28T06:42:09Z</dc:date>
    <item>
      <title>LPC 824 ADC - Issue in getting it to start conversion</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-824-ADC-Issue-in-getting-it-to-start-conversion/m-p/1038711#M40417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to read an analog signal on ADC 9 &amp;amp; 10. The issue I'm facing here is, despite setting the start bit to 1 the ADC is not launching the conversion sequence, i.e. the interrupt service routine isn't firing and also there is not update in the flag register. Kindly help. I have&amp;nbsp;mentioned the initialization function below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;void adc_init()&lt;BR /&gt;{&lt;BR /&gt; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;18); //Enable clock to IOCON&lt;BR /&gt; LPC_IOCON-&amp;gt;PIO0_13 = 0x00000000; //Disable pull up and pull down resistors&lt;BR /&gt; LPC_IOCON-&amp;gt;PIO0_17 = 0x00000000; //Disable pull up and pull down resistors&lt;BR /&gt; &lt;BR /&gt; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;7); //Enable clock to switch matrix&lt;BR /&gt; LPC_SWM-&amp;gt;PINENABLE0 |= (0&amp;lt;&amp;lt;23); //Enable ADC_10 on PIO0_13&lt;BR /&gt; LPC_SWM-&amp;gt;PINENABLE0 |= (0&amp;lt;&amp;lt;22); //Enable ADC_9 on PIO0_17&lt;BR /&gt; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (0&amp;lt;&amp;lt;7); //Disable clock to switch matrix&lt;BR /&gt; &lt;BR /&gt; LPC_SYSCON-&amp;gt;PDRUNCFG |= (0&amp;lt;&amp;lt;4); //Power the ADC&lt;BR /&gt; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;24); //Enable clock to ADC&lt;BR /&gt; &lt;BR /&gt; LPC_SYSCON-&amp;gt;PRESETCTRL |= (0&amp;lt;&amp;lt;24); //RESET ADC&lt;BR /&gt; LPC_SYSCON-&amp;gt;PRESETCTRL |= (1&amp;lt;&amp;lt;24);&lt;BR /&gt; &lt;BR /&gt; LPC_ADC-&amp;gt;SEQA_CTRL |= (0&amp;lt;&amp;lt;31); //Disable sequence A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LPC_ADC-&amp;gt;CTRL = 1; //Set clock div 1&lt;BR /&gt; &lt;BR /&gt; LPC_ADC-&amp;gt;SEQA_CTRL |= (1&amp;lt;&amp;lt;10)|(1&amp;lt;&amp;lt;9)|(1&amp;lt;&amp;lt;30); //Sequence A, channel 10, channel 9, EOS enabled&lt;BR /&gt; &lt;BR /&gt; LPC_ADC-&amp;gt;FLAGS = 0X00000000; //Clear all flags&lt;BR /&gt; &lt;BR /&gt; LPC_ADC-&amp;gt;INTEN |= (1&amp;lt;&amp;lt;0); //sequence A interupt enabled&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NVIC_EnableIRQ(ADC_SEQA_IRQn); //Enable NVIC interrupt&lt;BR /&gt; &lt;BR /&gt; LPC_ADC-&amp;gt;SEQA_CTRL |= (1&amp;lt;&amp;lt;31)|(1&amp;lt;&amp;lt;18); //Enable sequence A&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void start_adc()&lt;BR /&gt;{&lt;BR /&gt; LPC_ADC-&amp;gt;SEQA_CTRL |= (1&amp;lt;&amp;lt;26); //start sequence A&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void ADC_SEQA_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; SendData0("In handler\n");&lt;BR /&gt; &lt;BR /&gt; if((LPC_ADC-&amp;gt;FLAGS &amp;amp; (1&amp;lt;&amp;lt;28)) == 1) //Check for Sequence completion&lt;BR /&gt; sequence_complete = 1;&lt;BR /&gt; &lt;BR /&gt; LPC_ADC-&amp;gt;FLAGS |= (0&amp;lt;&amp;lt;28); //clear flags&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint16_t get_data_adc(int chno)&lt;BR /&gt;{&lt;BR /&gt; uint16_t data;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; rawvalue = LPC_ADC-&amp;gt;DAT[chno];&lt;BR /&gt; &lt;BR /&gt; data = (rawvalue &amp;amp; 0X0000FFF0)&amp;gt;&amp;gt;4;&lt;BR /&gt; &lt;BR /&gt; rawvalue = 0;&lt;BR /&gt; &lt;BR /&gt; return data;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; int v1,v2;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; SystemCoreClockUpdate();&lt;BR /&gt; &lt;BR /&gt; GpioInit();&lt;BR /&gt; Uart0Init(9600,8,'N',1);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; adc_init();&lt;BR /&gt; &lt;BR /&gt; while(1)&lt;BR /&gt; {&lt;BR /&gt; start_adc();&lt;BR /&gt; while(sequence_complete != 1);&lt;BR /&gt; sequence_complete = 0;&lt;BR /&gt; &lt;BR /&gt; v1 = get_data_adc(10);&lt;BR /&gt;v2= get_data_adc(9);&lt;BR /&gt; &lt;BR /&gt; sprintf(result,"%d %d\n",v1,v2);&lt;BR /&gt; SendData0(result);&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Nov 2019 04:36:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-824-ADC-Issue-in-getting-it-to-start-conversion/m-p/1038711#M40417</guid>
      <dc:creator>flourishaprince</dc:creator>
      <dc:date>2019-11-27T04:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: LPC 824 ADC - Issue in getting it to start conversion</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-824-ADC-Issue-in-getting-it-to-start-conversion/m-p/1038712#M40418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Flourisha,&lt;/P&gt;&lt;P&gt;Regarding your code, I think you have to check the bit configuration.&lt;/P&gt;&lt;P&gt;1)clear bit4 to power the ADC, but you do nothing with the code. Setting bit4 to power down rather than power up.&lt;/P&gt;&lt;P&gt;LPC_SYSCON-&amp;gt;PDRUNCFG |= (0&amp;lt;&amp;lt;4); //Power the ADC&lt;/P&gt;&lt;P&gt;modify it to:&lt;/P&gt;&lt;P&gt;LPC_SYSCON-&amp;gt;PDRUNCFG &amp;amp;= ~(0&amp;lt;&amp;lt;4); //Power the ADC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/94651iFF9762595A5D0679/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)clear the bit in PINENABLE0 to enable the ADC function for the pin, but you set the bit with the code:&lt;/P&gt;&lt;P&gt;LPC_SWM-&amp;gt;PINENABLE0 |= (0&amp;lt;&amp;lt;23); //Enable ADC_10 on PIO0_13&lt;BR /&gt; LPC_SWM-&amp;gt;PINENABLE0 |= (0&amp;lt;&amp;lt;22); //Enable ADC_9 on PIO0_17&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/94781iA1E22EEB4D35DF1C/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You should use&lt;/P&gt;&lt;P&gt;LPC_SWM-&amp;gt;PINENABLE0 &amp;amp;=~ (0&amp;lt;&amp;lt;23); //Enable ADC_10 on PIO0_13&lt;BR /&gt; LPC_SWM-&amp;gt;PINENABLE0 &amp;amp;= ~(0&amp;lt;&amp;lt;22); //Enable ADC_9 on PIO0_17&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)for reset:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; LPC_SYSCON-&amp;gt;PRESETCTRL &amp;amp;= ~(0&amp;lt;&amp;lt;24); //RESET ADC&lt;BR /&gt; LPC_SYSCON-&amp;gt;PRESETCTRL |= (1&amp;lt;&amp;lt;24);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls have a try.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Nov 2019 06:42:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-824-ADC-Issue-in-getting-it-to-start-conversion/m-p/1038712#M40418</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2019-11-28T06:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: LPC 824 ADC - Issue in getting it to start conversion</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-824-ADC-Issue-in-getting-it-to-start-conversion/m-p/1038713#M40419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot. This solved the issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Nov 2019 08:59:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-824-ADC-Issue-in-getting-it-to-start-conversion/m-p/1038713#M40419</guid>
      <dc:creator>flourishaprince</dc:creator>
      <dc:date>2019-11-28T08:59:07Z</dc:date>
    </item>
  </channel>
</rss>

